LinuxQuestions.org
Review your favorite Linux distribution.
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-30-2004, 09:10 AM   #1
os2
Member
 
Registered: Dec 2003
Location: Canada
Distribution: openSUSE Tumbleweed
Posts: 209

Rep: Reputation: 30
create a library


hi

how to generate a .so, i have a program, i want to load a library... but i don't know how to generate a library file with gcc

thanks
 
Old 06-30-2004, 10:38 AM   #2
nodger
Member
 
Registered: Oct 2003
Location: Ireland
Distribution: Slackware 9.1, Ubuntu
Posts: 192

Rep: Reputation: 30
youre not FROM canada wohwohwohwohwohwohwohwohwohwohhttp://bbs.adultwebmasterinfo.com/
 
Old 06-30-2004, 11:30 AM   #3
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
I can't remember exactly, but my notes mentioned this:
Code:
	
cc -c -fPIC app.c
cc -shared -o lib.so app.o
 
Old 06-30-2004, 04:21 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Here is a link to the publication 'Running Linux 3rd Edition' by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman
. The section on creating shared libraries is in section 13.1.7.1.

http://www.hk8.org/old_web/linux/run/ch13_01.htm
 
Old 06-30-2004, 10:29 PM   #5
rshinoy
LQ Newbie
 
Registered: May 2004
Posts: 10

Rep: Reputation: 0
Hi ,
You can do it in the following way

g++ -shared -Wl,-soname, $(TARGET).so $(OBJS) $(LIBS)

where $(OBJS) are your several objectfiles
------------
regards
rshinoy
 
  


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
Trying to create a shared library mukund_desh Linux - Software 1 05-24-2005 05:41 AM
Urgent! How to create a library (.so) file under KDevelop? jiapei100 Programming 1 03-16-2005 03:35 PM
How to write makefile to create shared library in 2.6 kernel yogeshwar_s Linux - Software 1 12-29-2004 12:39 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM
How to create a .deb library package? FloFri Debian 3 05-03-2004 11:12 AM

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

All times are GMT -5. The time now is 09:38 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