Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Message-ID: <016201c0ebfd$f8036840$0200a8c0@lifelesswks> From: "Robert Collins" To: Subject: dlsym discussion.. Date: Sun, 3 Jun 2001 17:22:37 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-OriginalArrivalTime: 03 Jun 2001 07:13:53.0795 (UTC) FILETIME=[BF2B5D30:01C0EBFC] I've been digging into libtool, trying to get a handle (no pun intended) on dynamic module loading and related issues. This is for another project, but cygwin is one of the supported platforms... Anyway I've uncovered a nasty issue in the cygwin dlsym() implementation. Using http://www.opengroup.org/onlinepubs/7908799/xsh/dlsym.html as my guide, it's my understanding that the following: handle=dlopen(NULL, ..) foo=dlsym(handle, "symbol_in_linked_shared_library") should resolve foo to the symbol in the linked shared library. However GetProcAddress only resolves symbols in the module pointed to by handle. this means that applications have to be aware of the dependencies of modules they load in order to be sure of resolving "passed thru" symbols. An example of such is a library that just adds a couple of functions to an existing API, and doesn't wrap the original API at all. (It shouldn't need to). Lemma: I spent a bit of time chasing a dead end - tring to resolve "main" - until I realised that gcc/libtool doesn't by default export any functions in the .exe. (In fact I'm not sure how to get it to export them). Such exporting would allow backlinking, which can be handy, even if it isn't all-that-portable. Thoughts? I'm a bit hesitant at trying to second guess what dll's have been implicitly loaded by the Win32System, but if that information is readily available to cygwin, I'm happy to code up a iterating dlsym()... Rob