LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-05-2009, 08:49 AM   #16
gubacsek
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Rep: Reputation: 0

Quote:
Originally Posted by jiml8 View Post
I am a bit surprised that worked.
Hmm... I tryed your version jiml8, and it is working also. I will compile my program that way in the future.

I have one more question: How is this linking working? If i link libmagic, and compile my program, will it run on machines, where libmagic is not present? I don't understand this part. Do i need the library only at compile time, or it is needed by the program at runtime also?
 
Old 06-05-2009, 08:55 AM   #17
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
You need to study the manpages on the linker (ld).

By default, libraries are dynamically linked in, which means the library must be present on the target system. You can statically link a library (if there is a .a version of it) in which case the contents of the library are added to the executable and the resulting program is self-contained. Usually using dynamic linking is better; smaller executables, less bloat, and protection against future upgrades that might break your statically linked program.
 
Old 06-05-2009, 01:48 PM   #18
gubacsek
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Rep: Reputation: 0
I understand. I asked because i was trying to decide which version would be better, and more flexible (portable). To use libmagic, or the file and grep version. I will use the dinamically linked libmagic version, and if i give my great and usefull program () to someone, i will try the static.
I will read more about this topic...

Many many thanks for your help jiml8, and all of you! I appreciate it very much!
You are the sort of guys, that a starter needs

Have a nice weekend!
 
  


Reply



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 file browser detects file type without .3 sufix? Leon_Amirreza Fedora 2 03-18-2007 10:20 PM
howto convert .flw (koffice/kivio file) into windows readable type of file? rahmmandel Linux - Desktop 7 01-30-2007 04:12 PM
determine encoding type of a file (ie - UTF-8) chovy Linux - Software 1 04-03-2006 12:46 AM
How do I determine file system type? lowpro2k3 Linux - General 5 07-09-2005 03:40 PM
How does KDE determine file type? vdemuth Linux - Software 4 01-08-2005 04:08 AM

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

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

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