This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: help for a newbie C Programmer
- From: "Gerrit P. Haase" <gp at familiehaase dot de>
- To: "Jag" <Jagjit at ntlworld dot com>
- Cc: cygwin at cygwin dot com
- Date: Wed, 13 Aug 2003 15:08:24 +0200
- Subject: Re: help for a newbie C Programmer
- Organization: Esse keine toten Tiere
- References: <007d01c36189$acf99f00$6401a8c0@jag750>
- Reply-to: "Gerrit @ cygwin" <cygwin at cygwin dot com>
Hallo Jag,
Am Mittwoch, 13. August 2003 um 12:57 schriebst du:
> Hi,
> I am trying to port some socket code from AIX onto unix.
> When I try to link the code I get ' ld: cannot find -lsocket'
> The line being executed is :
> ld -dy -G -o libbridge.so bridge.o nwutil.o
> jagsocket.o -Bstatic -lc -lsocket -lnsl
> I have searched for socket.a and nsl.a in the cygwin directory but they
> aren't there.
> The makefile works on AIX and I was hoping it would be a straight forward
> compilation on windows 2k.
> Can anyone please point me in the right direction !
Use gcc to link. libc, libsocket and libnsl are all included in
libcygwin which you don't need to propagate to the linker:
gcc -shared -o libbridge.dll \
-Wl,--out-implib=libbridge.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--whole-archive \
bridge.o nwutil.o jagsocket.o \
-Wl,--no-whole-archive \
${dependency_libs}
where ${dependency_libs} may be any libraries your library is
depending on (like -lstdc++ for C++ libraries).
-Wl,--out-implib=libbridge.dll.a results in the import library which
you can use to link your application against (with -L/path -lbridge).
Gerrit
--
=^..^=
--
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/