LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-20-2008, 06:38 AM   #1
priyeshwadhwa
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
Question Functions in .so file not called.


Why will this happen? I created .so file containing the .o files needed. When I call functions of this .so, a particular file's functions are not called.

Initial guesses:
name clashes. If it can happen how to know it?
 
Old 02-21-2008, 03:14 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
We may need a better description of what you mean by "a particular file's functions are not called".

But it brings to mind an issue some of my coworkers struggled with when porting a .dll from Windows into a .so for Linux:

If a function is both called in a .dll and defined in that .dll then the instance of that function defined in that .dll is the instance of that function that will be called by that .dll. That is the behavior our software wanted.

But if a function is both called in a .so and defined in that .so and some other instance of a function with the same name is loaded earlier, then that other instance of the function will be used.

To my limited understanding of the relative behavior of the linkers: Linking a DLL on Windows defaults to resolving local to the DLL anything that can be resolved local to the DLL and importing/exporting only those things it needs to and/or is told to. But linking a .so in Linux defaults to importing/exporting anything it can, so a lot more can change at load time.

If that isn't your issue, sorry I jumped in.

If that is your issue, hopefully someone with better understanding of the GNU linker will tell us both how to get better control of linking a .so to force some (for me almost all) symbols to be resolved with finality at link time and not left open for the loader.

Last edited by johnsfine; 02-21-2008 at 03:16 PM.
 
Old 02-22-2008, 05:05 AM   #3
priyeshwadhwa
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by johnsfine View Post
But if a function is both called in a .so and defined in that .so and some other instance of a function with the same name is loaded earlier, then that other instance of the function will be used.
I think that is what most probably the issue is. However I tried to use LD_LIBRARY_PATH to get my library used first. That too didn't solved the purpose.

Quote:
Originally Posted by johnsfine View Post
If that is your issue, hopefully someone with better understanding of the GNU linker will tell us both how to get better control of linking a .so to force some (for me almost all) symbols to be resolved with finality at link time and not left open for the loader.
Yes, need a way to force it to use my library first rather that going for any other that may have same functions.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
What is the Linux file system called? gooshto Linux - Newbie 7 11-23-2005 08:14 PM
deleting a file called --nostop stefaandk Linux - Newbie 1 07-31-2005 07:32 PM
Which config file is called for wireless pcmcia Wolfgang67 Slackware 1 07-04-2004 05:21 AM
delete a file called -n chris2000g Linux - Newbie 5 12-06-2003 09:18 AM
In which file the syslogd is called? zhu_liheng Linux - Newbie 2 10-01-2003 10:29 PM


All times are GMT -5. The time now is 04:08 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration