This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extern keyword and dlls


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]