Re: extern keyword and dlls

2008-02-10 Thread Václav Haisman
masta uy wrote, On 11.2.2008 0:40: Hello, 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. This code triggers the error: extern int num; int foo() { extern int num; num = 5; } You are missing a definition

Re: extern keyword and dlls

2008-02-10 Thread Brian Dessent
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

extern keyword and dlls

2008-02-10 Thread masta uy
Hello, 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. This code triggers the error: extern int num; int foo() { extern int num; num = 5; } the error is: hello.c:(.text+0x5): undefined reference to `_num