delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/11/24/04:29:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Trace: 110833985/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.66.11.8/None/johne53 AT tiscali DOT co DOT uk
X-SBRS: None
X-RemoteIP: 79.66.11.8
X-IP-MAIL-FROM: johne53 AT tiscali DOT co DOT uk
X-MUA: Microsoft Outlook Express 6.00.2900.2180Produced By Microsoft MimeOLE V6.00.2900.2180
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ArEEAA4CKklPQgsI/2dsb2JhbACEElnKW4J8
X-IronPort-AV: E=Sophos;i="4.33,658,1220223600"; d="scan'208";a="110833985"
Message-ID: <003a01c94e17$0d87fcc0$4001a8c0@mycomputer>
From: "John Emmas" <johne53 AT tiscali DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
Subject: Opening a (cygwin-ised) DLL
Date: Mon, 24 Nov 2008 09:28:47 -0000
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Suppose I'm building a Linux app under Cygwin and that app builds an
executable and a DLL.  At run time, what would be the preferred method
for the executable to open the DLL under Cygwin - LoadLibrary() or
dlopen() ?

I'm assuming that dlopen() is better for portability - but given that the
DLL is (presumably) a pretty standard Windows DLL, is there possibly
an argument for using a preprocessor directive, like this ? - e.g.

#if defined(WIN32) || defined(__CYGWIN__)
#define LoadLib(name) LoadLibrary(name)
#else
#define LoadLib(name) dlopen((name), RTLD_NOW)
#endif

Obviously, the same kind of directives would need to be applied when 
unloading the library and getting symbol addresses etc.

Thanks,

John

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019