extern keyword and dlls

Brian Dessent brian@dessent.net
Mon Feb 11 06:30:00 GMT 2008


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/



More information about the Cygwin mailing list