X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: Uu383n6swBCEN1G9up0WSnxbvN8fCPmk Message-ID: <4C7B0ECF.8050209@cygwin.com> Date: Sun, 29 Aug 2010 21:52:15 -0400 From: "Larry Hall \(Cygwin\)" Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090320 Remi/2.0.0.21-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Linking shared libraries problem References: <4C7AE88B DOT 2000309 AT gmail DOT com> In-Reply-To: <4C7AE88B.2000309@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 8/29/2010 7:08 PM, Tomás Staig wrote: > Hi, > I have been trying to port some software from Linux (Scientific Linux/RedHat) > to windows using Cygwin. I have been able to port most of it with little > changes but I encountered a problem when linking shared libraries. It seems > that the chain of dependencies is not included when linking. Furthermore, ldd > does not show the dependency libraries as in Linux. I have tried both using > the import libraries (%.dll.a) and linking the dll files (%.dll) directly. > > I have arranged a small example program that reproduces this effect. > Used Ubuntu 8.04 to and "CYGWIN_NT-5.1" version "1.7.6(0.230/5/3) 2010-08-16 > 16:06" on top of a 32-bits Windows XP Machine to test the above examples. > As you can see, there is no reference to liby.dll. I could add the library > (-ly) directly to the compiling line of main and it works, but the truth is > that it would not be a good approach, since in the software I'm trying to > port, there are several dependent modules, so the last ones would have an > incredibly large list of dependencies. > > So, am I doing something wrong? Is there any way to add the dependency to be > shown with ldd or any workaround(maybe a linker flag or something) to make > the above example work? The Windows loader requires full resolution at link time. You need to list at least the import libraries for all dependencies if you want the link to succeed. Sorry, that's just the way Windows works. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple