LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 0
Path of dynamic link library


Hello,

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 configure.ac file, but I'm quite newbie in configure's macros. Or maybe the other solution is search for library in software ?

BR
 
Old 04-28-2010, 04:19 PM   #2
raconteur
Member
 
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, 07:17 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Quote:
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:
Quote:
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 "libmy_sharedlib.so", 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"
EXAMPLE: export LD_LIBRARY_PATH=/some/directory:$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

PS:
Raconteur - I like the Shakespeare quote

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


Reply

Tags
configure



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:32 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
Open Source Consulting | Domain Registration