Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 04-28-2010, 02:56 PM   #1
LQ Newbie
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
Path of dynamic link library


I'd like to get path of one library to link it dynamicly in my program.
Probobly the best way would be to add macro to my file, but I'm quite newbie in configure's macros. Or maybe the other solution is search for library in software ?

Old 04-28-2010, 05:19 PM   #2
Registered: Dec 2007
Location: Slightly left of center
Distribution: slackware
Posts: 276
Blog Entries: 2

Rep: Reputation: 44
This is a confusing question.

I'm going to assume that you have successfully built the program and linked it.
If that isn't the case, please elaborate (but, in general, libraries are installed in standard locations and the paths to search for libraries can be specified or expanded on the compiler/linker command line, with environment variables, or makefile directives).

Otherwise, I think your question really is about determining whether the required library exists on a target installation platform.

If that is the case, the easiest way is to copy and edit an existing aclocal segment that verifies a library's existence in a configuration script.
Old 04-28-2010, 08:17 PM   #3
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I'd like to get path of one library to link it dynamically in my program.
I'm not quite sure what you mean, but it probably falls under one of these three scenarios:
1. You're building your own program, and you want to use a dynamic library.
SOLUTION: use -L in your link command
EXAMPLE: gcc -o my_exe my_obj1.o my_obj2.o -L /some/directory -lmy_sharedlib
<= in this example, the shared library would be called "", and could be found in "/some/directory".

2. You're running a program that uses a shared library
SOLUTION: set the environment variable "LD_LIBRARY_PATH"

3. You have an executable, and you want to see what shared libraries it uses
SOLUTION: use "ldd"
EXAMPLE: ldd my_exe
'Hope that helps .. PSM

Raconteur - I like the Shakespeare quote

Last edited by paulsm4; 04-28-2010 at 08:18 PM.



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
How can we convert a dynamic library ( to a static library (filename.a). hanumaan Programming 4 11-20-2009 01:07 AM
Which dynamic library is being used? sysbox Linux - Software 6 10-06-2009 02:06 PM
how to include the path of exe in the ld library path? malli42108 Linux - Networking 10 09-17-2009 10:21 AM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
dynamic library versioning kev82 Linux - General 9 12-13-2003 10:24 PM > Forums > Non-*NIX Forums > Programming

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

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