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, 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 of num. All you have now is just a declaration.



the error is:

hello.c:(.text+0x5): undefined reference to `_num'

And this is how I call gcc: "gcc -shared hello.c"

Interestingly, the code above does work on my ubuntu installation (ubuntu 7.10 gcc 4.1.3)

Any help is appreciated

Regards
Fernando

-- VH

Attachment: signature.asc
Description: OpenPGP digital signature


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