Missing global variables from lib

R

Rajesh

Hi

I am using VC 6.0 on Win2k

I have multiple win32 static libs... each of the lib has global
variables and in the constructor of these variables i have
registeration code. This registeration code is a external function
whose implementation is in the dll..

But when I link and get the dll... these global variables seems to be
missing and the constructor code never gets executed.

Is the variables getting eliminated by the linker as it is not getting
directly used anywhere in the lib?

Is there a way I can avoid this and say export all symbols?

Regards
Rajesh
 
V

Victor Bazarov

Rajesh said:
I am using VC 6.0 on Win2k

Then you should *consider* posting to 'microsoft.public.vc.language'. Not
that we don't know the answers _specific_ to that compiler, it's just that
this is not a good place for them.

Also, you should *consider* upgrading your compiler. VC++ v6 is quite old
and its successor, v7.1 is much better in terms of standard compliance.
I have multiple win32 static libs... each of the lib has global
variables and in the constructor of these variables i have
registeration code. This registeration code is a external function
whose implementation is in the dll..

But when I link and get the dll... these global variables seems to be
missing and the constructor code never gets executed.

DLLs are compiler- and OS-specific. As such they are OT here.
Is the variables getting eliminated by the linker as it is not getting
directly used anywhere in the lib?

Impossible to tell in terms of the Standard C++ language. Linking is not
defined by the language specification.
Is there a way I can avoid this and say export all symbols?

Again, this is compiler- and OS-specific. You'll have to ask in a VC++
forum. Try 'microsoft.public.vc.language'.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top