public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Larry Hall (RFK Partners, Inc)" <lhall@rfk.com>
To: cygwin@cygwin.com
Subject: Re: Problems linking program
Date: Mon, 22 Apr 2002 13:25:00 -0000	[thread overview]
Message-ID: <4.3.1.2.20020422154735.02a5ef08@pop.ma.ultranet.com> (raw)
In-Reply-To: <3CC4671C.5070606@ece.gatech.edu>

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@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@rfk.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/

  reply	other threads:[~2002-04-22 19:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-22 11:40 Matt Minnis
2002-04-22 12:11 ` Larry Hall (RFK Partners, Inc)
2002-04-22 12:55   ` Charles Wilson
2002-04-22 13:25     ` Larry Hall (RFK Partners, Inc) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-04-18 11:18 Matt Minnis
2002-04-18 12:37 ` Larry Hall (RFK Partners, Inc)
2002-04-19 13:42   ` Matt Minnis
2002-04-21 13:46     ` Guy Harrison
2002-04-21 19:49     ` Larry Hall (RFK Partners, Inc)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.3.1.2.20020422154735.02a5ef08@pop.ma.ultranet.com \
    --to=lhall@rfk.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).