X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org X-Authority-Analysis: v=1.0 c=1 a=xe8BsctaAAAA:8 a=q0m40p-eAdI-4a5ITaAA:9 a=9qEE92x90YysRU6ad40Af0nvPzkA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10 Message-ID: <492AA69C.2030806@byu.net> Date: Mon, 24 Nov 2008 06:05:32 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com, johne53 AT tiscali DOT co DOT uk Subject: Re: Opening a (cygwin-ised) DLL References: <003a01c94e17$0d87fcc0$4001a8c0 AT mycomputer> In-Reply-To: <003a01c94e17$0d87fcc0$4001a8c0@mycomputer> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to John Emmas on 11/24/2008 2:28 AM: > 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() ? Hands down 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. No. Using LoadLibrary means you are going behind cygwin's back, and if there is something that cygwin does as part of dlopen that you don't do when you manually use LoadLibrary, then you are likely to lose the Posixy semantics that cygwin was trying to give you. In other words, you should treat dlopen as a wrapper around more action than just a simple LoadLibrary, not as a synonym to LoadLibrary. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkkqppwACgkQ84KuGfSFAYAn0gCeLwzNL2degOc//GNQ/xwCFGu8 L+wAoNLnnoZrzHUvnSPSEk1oquPK/+fz =uZnE -----END PGP SIGNATURE----- -- 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/