472,328 Members | 1,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

dynamic library loading, missing symbols

While my question doesn't pertain specifically to python programming,
it is a result of developing a python module, so I'm hoping someone
here might have experience with this issue.

So, first a little background to how the system works right now. I am
developing a module for Python. The original code is written in C++ and
I am creating a wrapper using Boost.Python. The C++ code for the module
makes calls into a library that in turn dynamically loads a library
(using dlopen). This dynamically loaded library, in turn, expects to
find a symbol in the code that loaded it (using extern it declares a
variable). However, the linker fails at runtime here because it can't
find this symbol. The variable in question does exist in the C++ code
that in does dlopen.

The reason for the complication is that I don't have control over how
the library does dlopen() or how the code that calls dlopen was
compiled. I am, however, able to control the build process for the
Boost.Python wrapper and the original C++ code that the Boost.Python
wraps. I've tried as many linker tricks as I can think of to get this
to work. Both the boost wrapper and the C++ code that it wraps are
built using --export-dynamic.

Is there a way to set at runtime what directories or libraries the
linker should search for these symbols? I have set LD_LIBRARY_PATH
correctly, but that didn't seem to affect anything.

For reference, I am running on Gentoo linux 2.6.11.12 with gcc 3.4.4

I'm interested in any ideas that might help, but the ideal one should
work on any *nix system and not just linux.

(Please don't suggest that I change the operation of the code that is
doing dlopen, as it is 3rd party and not something that would be in our
best interest to work on).

If you think I need to provide more information, I'd be happy to try
and clarify things.

Thanks,
~Doug

Jan 10 '07 #1
1 2283
df****@gmail.com schrieb:
However, the linker fails at runtime here because it can't
find this symbol. The variable in question does exist in the C++ code
that in does dlopen.
Did you verify, using nm -D, that the symbol is indeed present in
the shared object, not just in the source code?
The reason for the complication is that I don't have control over how
the library does dlopen() or how the code that calls dlopen was
compiled.
What flags are given to that dlopen call?
Is there a way to set at runtime what directories or libraries the
linker should search for these symbols?
No. The dynamic linker doesn't search files to resolve symbols; instead,
it searches the process' memory. It first loads the referenced shared
libraries (processing the DT_NEEDED records in each one); that uses
the LD_LIBRARY_PATH. Then, symbol resolution needs to find everything
in the libraries that have already been loaded.

There are various ways to control which subset of in-memory symbols
the dynamic linker considers: the RTLD_GLOBAL/RTLD_LOCAL flags play
a role, the -Bsymbolic flag given to the static linker has an impact,
and so does the symbol visibility (hidden/internal/protected).

Regards,
Martin
Jan 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: cwnewbe1 | last post by:
I would like to be able to add environment symbols to the Microsoft XP registry. I tried the example in the Python Cookbook by Orielly by running...
17
by: Aguilar, James | last post by:
My previous example used the concept of a Shape class heirarchy, so I will continue with that. Suppose I have something like fifty different...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application...
4
by: Matt Sawyer | last post by:
I am attempting to use an API (CxApiOem.dll) that has a large number of defines and complicated structs. It's just too much hassle to attempt to...
1
by: Robert McLay | last post by:
I have been trying to build python on Cray X1. As far as I can tell it does not support dynamic loading. So the question is: How to build 2.4...
4
by: yhebib | last post by:
Hello All, I've been browsing and reading all articles I could find on technet ,msdn and other knowledgeable sources to understand the issue I'm...
0
by: shan | last post by:
*** ERROR: Module load completed but symbols could not be loaded for crystaldecisions.web.dll *** ERROR: Module load completed but symbols could...
2
by: vlbel | last post by:
I'm trying to do the following: 1) The main program consists of ------------ a.h ------------ class A { public: virtual ~A(){} virtual void...
20
by: Nickolai Leschov | last post by:
Hello all, I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices)....
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.