LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-13-2007, 10:59 AM   #1
Millenniumman
Member
 
Registered: Apr 2006
Posts: 81

Rep: Reputation: 15
Linux Dynamically Loaded Libraries and Global Variables


I have two libraries that are very similar but function a little differently (text handling). One of them is dynamically linked to my application, and the other is dynamically loaded by it. If they both have a global variable named the same thing, should the variables function independently? i.e., if I set the variable in library2, will it affect the variable in library1?
 
Old 06-13-2007, 11:28 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
global variables have file scope.

C99:
Quote:
If the declarator or type specifier that declares the identifier
appears outside of any block or list of parameters, the identifier has file scope, which terminates at the end of the translation unit.
 
Old 06-13-2007, 11:32 AM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
I may be wrong here but I think it is restricted to the unit and therefore is not global to the whole application.

[edit] yep like jim said
 
Old 06-13-2007, 11:37 AM   #4
Millenniumman
Member
 
Registered: Apr 2006
Posts: 81

Original Poster
Rep: Reputation: 15
Thanks. Knowing that, is there any way to get gdb to show the current library? I know it shows it in the stack when the library has no symbols, but how do you get it to show it for libraries with symbols? Normally, they show source files instead, and I can't find a way to show the library.

Last edited by Millenniumman; 06-13-2007 at 11:39 AM.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see (dynamically) imported libraries? G00fy Programming 2 04-30-2007 05:27 AM
Dynamically linked libraries.. vishalbutte Programming 6 04-17-2006 08:54 PM
Local vs Global variables wujee Programming 1 03-11-2005 11:43 PM
Linux 2.5.69 extern global variables odomae Linux - Newbie 1 06-24-2003 04:03 PM
global variables in php champ Programming 2 10-13-2002 01:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration