delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <48F0AAE9.7B7C80B4@dessent.net> |
Date: | Sat, 11 Oct 2008 06:32:25 -0700 |
From: | Brian Dessent <brian AT dessent DOT net> |
X-Mailer: | Mozilla 4.79 [en] (Windows NT 5.0; U) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Circular dependency problem |
References: | <002201c92b9d$c1759c20$4001a8c0 AT mycomputer> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
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 |
John Emmas wrote: > functions contained in the other one). If I was programming in Microsoft > VC++ I'd normally resolve this by exporting the relevant functions. > Exporting them (I believe) tells the linker that any unresolved function > addresses will be resolved at run time (hence, dynamic linking). That's not how DLLs work. All references must be defined at link time, there is no way to defer them to runtime unless you explicitly use LoadLibrary/GetProcAddress and function pointers. __declspec(dllexport) does not change the situation at all. What you probably meant was that you (or perhaps the IDE did it for you) created a .def file which lists the exported functions of a DLL before it actually exists, which can be used to create an import library for linking. > I don't know how the equivalent technology works in gcc but whatever it > involves, the project compiles and links fine on my Linux box. However, > I can't make it build with Cygwin. Both branches compile successfully but > neither will link because the other one hasn't been built yet. > > Is there anywhere where I can find some information about how to make > this work? I could probably make a cut-down version if anyone wants to see > the problem for themselves. Create a .def file listing the exported functions of library A, and then generate an import library from that. Link library B against the library A import lib and at the same time create an import library for B. Then link library A against that. $ dlltool -d libA.def -l libA.dll.a $ gcc -shared $libB_objects -o libB.dll -L. -lA \ -Wl,--out-implib,libB.dll.a $ gcc -shared $libA_objects -o libA.dll -L. -lB Brian -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |