This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: extern keyword and dlls
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Sun, 10 Feb 2008 16:47:00 -0800
- Subject: Re: extern keyword and dlls
- References: <BAY112-W28AE51E3894A2B44C59C2DF6290@phx.gbl>
- Reply-to: cygwin at cygwin dot com
masta uy wrote:
> I am in working on porting some code to cygwin but I am stuck. I need it to be compiled as a dll but gcc gives me a linking error.
In short, you have to declare num as __declspec(dllimport) if it refers
to a variable in another module. See
<http://www.haible.de/bruno/woe32dll.html> for a thorough explanation of
all the differences between PE and ELF shared libraries, and the various
workarounds to cope with them.
> Interestingly, the code above does work on my ubuntu installation (ubuntu 7.10 gcc 4.1.3)
These are different platforms, and shared libraries work differently.
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/