GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Dec-2005, 03:36
svhb svhb is offline
New Member
 
Join Date: Jun 2005
Posts: 11
svhb is on a distinguished road

linking libraries removes variables


hello,

In my project, some variables global variables are placed in a library. These variables are used in a class that also has a global instance in that library. The contructor of that class places pointers to the data in a list that is defined elsewhere.
The data is never looked at directly, but through that list.

It seems that the linker is getting rid of all data used in this manner, so the data is not available.

When I put all data and the instance of the class in the min cpp file, the linker puts it in the executable.

I'm using the gcc compiler.

Any attributes, linker options, ... available to force the system to keep the data in the executable??

Thanks,

Stefaan
  #2  
Old 06-Dec-2005, 03:50
svhb svhb is offline
New Member
 
Join Date: Jun 2005
Posts: 11
svhb is on a distinguished road

Re: linking libraries removes variables


Some progress.

It seems that the file as a whole entity is removed. As soon as I force the linker to use a small part of the file, the rest of tha data is also available.

I've put another global variable in the source file (int dummy, and use it in the main source file (extern int dummy.

The problem is that I will have a lot of such issues, and I can not use a dummy variable in the main project file for every library I use.

Any idea's?


Stefaan
 
 

Recent GIDBlogWelcome to Baghdad by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing variables out of an iframe by url JUNK KED MySQL / PHP Forum 5 31-Jul-2007 09:33
Bloodshed Dev C++ Project Options JdS C++ Forum 6 11-Nov-2005 17:23
The Use of GLobal variables Peter11111 C Programming Language 3 12-Aug-2005 08:08
variables return to previous value after i try to set them nasaiya MS Visual C++ / MFC Forum 2 14-Jun-2005 00:43

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:41.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.