473,789 Members | 2,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2368
df****@gmail.co m 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
2146
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 the script locally and it worked fine. Although I noticed that even though the symbol showed immediatedly in the registry by viewing with regedit but not via a new dos command console, thus, I am forced to reboot to make it 'lock in'. Is this normal? My wish is to have the script invoked in...
17
4814
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 shapes, and I am trying to instantiate one of them. The trick is, the instatiation will be based on a string with the exact same name as the type that I am trying to instantiate. Obviously, writing a fifty element long switch statement is an inferior solution. So, how can I instantiate based on...
9
4496
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 to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
4
6901
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 use DLLImport to make the desired API calls. Instead, I created a managed C++ DLL (OneBoxAPI.dll) that wraps the desired API calls in a manner which is easy to call from C#. This way I can use the header files that are part of the API for all the defines and structs. I am having a problem...
1
1810
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 without dynamic loading? That is: can I build 2.4 where all the extensions are archived in libpython2.4.a as a static library? Building on the Cray X1 is slow, so I have been trying to also build it under Linux without dynamic loading since it
4
4450
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 dealing with. However, I did not find so far how to fix that. Investigations are still under progress and I hope you'll be able to give hints or feedback that will drive me to the solution. The applications I'm working on until the next release that will soon
0
1220
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 not be loaded for crystalenterpriselib.dll *** ERROR: Module load completed but symbols could not be loaded for crystalreportpluginlib.dll *** ERROR: Module load completed but symbols could not be loaded for crystalinfostorelib.dll
2
2042
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 b(); };
20
4305
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). The supplied library has .LIB and .H files. How can I dynamically load a LIB file and access all its functions? Surely someone has solved similar task? My intention is to use a Forth system for programming the controller,
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.