473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the absolute path of the library currently loaded?

Hi,

I was wondering if there was a way to know the absolute path of the
library "currently running".
For example, in my function foo, how can I get the path of the library
containing the definition of foo?

The library path will be different from the "current directory" (.)
since the current directory will be the directpry of the prgram that
loaded the lib; not the path to the library itself.

Otherwise, do you know fi the STL library provide a "registry service"
(like the java Preferences API)?

Thanks a lot for your help

May 3 '06 #1
4 5466
br***********@g mail.com wrote:
Hi,

I was wondering if there was a way to know the absolute path of the
library "currently running".
For example, in my function foo, how can I get the path of the library
containing the definition of foo?

The library path will be different from the "current directory" (.)
since the current directory will be the directpry of the prgram that
loaded the lib; not the path to the library itself.
That's very platform specific, some platforms might not even have
libraries or directories.

Better ask on a group specific to your platform.
Otherwise, do you know fi the STL library provide a "registry service"
(like the java Preferences API)?

No.

--
Ian Collins.
May 3 '06 #2
br***********@g mail.com wrote:
I was wondering if there was a way to know the absolute path of the
library "currently running".
There can be. However, it would be a feature of the OS, not of the
language.
In C++ what's "running" is the program, not "the library". The host system
_may_ provide the command with which it was started, in the 'argv[0]' (see
the 'main' function), or it may not, it's up to the system. Many systems
do,
yet some don't.
For example, in my function foo, how can I get the path of the library
containing the definition of foo?
C++ defines the _language_. In C++ you can find the _translation unit_ in
which the *code* is contained (see __FILE__ macro). The rest is platform-
and implementation-specific (and off-topic here).
The library path will be different from the "current directory" (.)
since the current directory will be the directpry of the prgram that
loaded the lib; not the path to the library itself.
All those things are unknown to C++.
Otherwise, do you know fi the STL library provide a "registry service"
(like the java Preferences API)?


Nothing like that in the Standard.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 3 '06 #3
> I was wondering if there was a way to know the absolute path of the
library "currently running".
For example, in my function foo, how can I get the path of the library
containing the definition of foo?


on unix : ldd ./a.out (./a.out is the executable )
macosX : oTool ./a.out

regards,
Aman Angrish.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
May 3 '06 #4
br***********@g mail.com wrote:
Hi,

I was wondering if there was a way to know the absolute path of the
library "currently running".
For example, in my function foo, how can I get the path of the library
containing the definition of foo?

The library path will be different from the "current directory" (.)
since the current directory will be the directpry of the prgram that
loaded the lib; not the path to the library itself.

Otherwise, do you know fi the STL library provide a "registry service"
(like the java Preferences API)?

Thanks a lot for your help

In unix type the following command :
$ ldd <executable name>

If you want to attach the libraries at the time of running, you have
update the LD_LIBRARY_PATH
Regards,

Thobias Vakayil

May 3 '06 #5

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

Similar topics

3
3138
by: Peter Taurins | last post by:
Hi there. I have an included file (header.php) that contanis a reference to a graphic. If I stay at the root level, then I can control the relative path of the image. eg. images/imagename.jpg However, if I include this file (header.php) in a lower level directory then of course, I end up with no image displaying as the relative path is no longer correct.
4
7020
by: dchaffin | last post by:
I'm having a problem using file_exists with an absolute path and I can not figure out why. I tried the exact example that is on www.php.net ... <?php $filename = '/path/to/foo.txt'; if (file_exists($filename)) { echo "The file $filename exists";
8
10849
by: Fu Bo Xia | last post by:
the java.lang.Object.forName method takes a java class name and returns a Class object associated with that class. eg. Class myClass = Object.forName("java.lang.String"); by if i only know the absolute file name of a .class file eg. C:\myJava\myApp.java, then how do i translate this file name to a java class name the Object.forName method would accept has it's parameter? thanks,
9
3701
by: Stuart | last post by:
Hi All, I got a challenge to make the same APS/Script/Html run on different web roots. I can not use relative pathing in a lot of cases. We use lots of included files so depending on where that file is running, the pathing in those included files varies. So we do a lot of absolute pathing. Example: Instead of Mappath("../../../_scripts/menu/mymenuscript.js") we use mappath("/_scripts/menu/mymenuscript.js"). In one case, the code is...
2
21271
by: mhadi | last post by:
Hi All, I am developing a solutions for clients to run some webpages. Since there is no webserver the ASP route is a No Go. So I am using Javascript to connect to my database. The Problem is that the following Connection string var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Data.mdb"; Search of Data.mdb on the desktop. I came to know that this requires absolute path i.e var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data
6
3178
by: Jon Slaughter | last post by:
do I have to prefix every absolute path with document root to get it to work? For some reason I thought that prefixing a path with '/' or './' with make it absolute w.r.t to document root but I guess not? e.g., when I do include './Scripts/AddNav.php';
11
26632
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
1
2966
by: Maanav Jackson | last post by:
Hi I am displaying a third party webpage into a variable using curl library. When i am displaying the variable in the browser using echo command as shown below. echo $pagecopy; Browser is not displaying the page as it display when we visit the page directly in browser. Instead it references all the file path,
13
2486
by: Nathan Sokalski | last post by:
I have a page in my site that I need the absolute url of. Is there a function in .NET to which you can pass a relative url or something such as "~/mydirectory/mypage.aspx" which will return an absolute url? I need this because at the moment I do not know what the domain name (or if there is the possibility of the site going in a subdirectory) where the site will eventually exist. Also, this will make it easier to test during development. I...
0
9487
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
9297
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
10069
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
9904
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...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
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...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
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();...
3
2697
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.