delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/22/15:56:00

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <4.3.1.2.20020422154735.02a5ef08@pop.ma.ultranet.com>
X-Sender: lhall AT pop DOT ma DOT ultranet DOT com
Date: Mon, 22 Apr 2002 15:53:03 -0400
To: cygwin AT cygwin DOT com
From: "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com>
Subject: Re: Problems linking program
In-Reply-To: <3CC4671C.5070606@ece.gatech.edu>
References: <5 DOT 1 DOT 0 DOT 14 DOT 2 DOT 20020422132917 DOT 025e76d0 AT mail DOT prefres DOT com>
<4 DOT 3 DOT 1 DOT 2 DOT 20020422143622 DOT 02a9ff00 AT pop DOT ma DOT ultranet DOT com>
Mime-Version: 1.0

At 03:40 PM 4/22/2002, Charles Wilson wrote:
>Larry Hall (RFK Partners, Inc) wrote:
>
>>>        ld -shared -o libgd.so.2.0.0 gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o
>>>gd_io_file.o gd_ss.o gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o   gdfontt.o gdfonts.o
>>>gdfontmb.o gdfontl.o gdfontg.o   gdtables.o gdft.o gdcache.o gdkanji.o wbmp.o
>>>gd_wbmp.o gdhelpers.o gd_topal.o -lfreetype -lgd -lz -ljpeg -lpng -lcygwin
>>>/usr/lib/libcygwin.a(_cygwin_crt0_common.o)(.text+0xe6): undefined reference to
>>>`GetModuleHandleA AT 4'
>
>>OK.  First, you shouldn't need to list -lcygwin.  It gets added automatically.
>>Fortunately now, it should be harmless to list it however.  That hasn't always
>>been the case so it's good not to get in the habit of adding it when it's not
>>needed.
>>'GetModuleHandle()' is a Win32 API.  You apparently have not installed the w32api package.  Rerun setup and do so.
>
>Nope -- the problem is he's using 'ld' directly to link the DLL.  Don't do that.  Instead of 'ld -shared', use 'gcc -shared'.  If you MUST pass linker specific options to ld, use '-Wl,--my-ld-option' in your gcc command line.


Ouch!  Chuck's right with this one.  I didn't pay attention to the link 
line, just the error.  Using 'ld' directly will not automatically pick 
up the w32api libraries, even if they are installed.  Use 'gcc' as Chuck
suggests.


>(BTW, naming your dll "foo.so.2.0.0" is a really bad idea.  Windows only supports shared libs that end in ".dll".)


Yeah, it still looks to me like Matt is trying to build the GNU C library
for some reason.  If it's to use with Cygwin, linking and correct naming
conventions for Windows will be the least of his problems! ;-)



Larry Hall                              lhall AT rfk DOT com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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