c shared libraries

Thread Solved

Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

c shared libraries

 
0
  #1
Nov 28th, 2008
hi, i need to create a c shared library on unix platform using korn shell. can you provide me with some sample codes please.
thanks
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

Re: c shared libraries

 
0
  #2
Nov 28th, 2008
come on guys, at least tell me a tutorial that teaches shared libraries in c on unix os.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 409
Reputation: StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light 
Solved Threads: 77
StuXYZ StuXYZ is offline Offline
Posting Pro in Training

Re: c shared libraries

 
0
  #3
Nov 28th, 2008
Actually, it is simply to use
  1. gcc -shared -o libmyshared.so file1.o file2.o

Have a look at the gcc manual. http://gcc.gnu.org/onlinedocs/.

The only thing that you will need to be a little careful of is were to put it so that it is system wide. That is normally defined as directories in /etc/ld.so.conf. That means if you put you lib in /usr/local/lib it normally works.

However, you can get round that by using it as
  1. gcc -Wl,-rpath,/home/serk/yourlocallibpath -o finishedProg file.o libmyshared.so

There are a few more options in the manual but really that covers just about everything. (obviously, you put that in your Makefile appropiately)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

Re: c shared libraries

 
0
  #4
Dec 1st, 2008
maybe because i use not unix but aix that command does not executes on my os.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 6,547
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 840
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: c shared libraries

 
0
  #5
Dec 1st, 2008
Well seeing as it took you 3 days to post some actual useful information about the problem, perhaps you could point us to an online manual for the compiler which you're having trouble reading.

Better yet, show us that you've tried to understand the manual by pasting some actual commands tried, and the results you got.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

Re: c shared libraries

 
0
  #6
Dec 2nd, 2008
Originally Posted by Salem View Post
Well seeing as it took you 3 days to post some actual useful information about the problem, perhaps you could point us to an online manual for the compiler which you're having trouble reading.

Better yet, show us that you've tried to understand the manual by pasting some actual commands tried, and the results you got.
what you say is just easy to say for me because i started this c and c++ thing so recent. i need some one who can tell the things from a c# programmer's stand point. for an example i can ask you this : in c# we have dll files to share functionality, whereas in c there are include files and libraries, i just wonder if you can share functionality with include files(at least header files) why do you need to create a library with .a extention. i think i havent seen the big picture yet. i also wonder the future of c and c++. compared to c# they are so slow to create some useful stuff. i consider future of these languages because i dont want to invest time learning all the details if those details will be all obsolete in 2-3 years. what do you think?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 6,547
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 840
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: c shared libraries

 
0
  #7
Dec 3rd, 2008
I think your estimation of C and C++'s imminent demise is overrated.

Nobody is going to be writing an entire OS / mobile phone / any other handheld consumer electronic device entirely in C# any time soon.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

Re: c shared libraries

 
0
  #8
Dec 3rd, 2008
Originally Posted by Salem View Post
I think your estimation of C and C++'s imminent demise is overrated.

Nobody is going to be writing an entire OS / mobile phone / any other handheld consumer electronic device entirely in C# any time soon.
sooner or later OS can be written in c# using some special frameworks.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

Re: c shared libraries

 
0
  #9
Dec 3rd, 2008
By the way Salem, i think i use VisualAge C++ professional / and C for AIX Compiler, Version 6 .

Tell me some useful information about these please..
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,058
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 124
Featured Poster
serkan sendur serkan sendur is offline Offline
Banned

Re: c shared libraries

 
0
  #10
Dec 3rd, 2008
Anyway thank you Salem, i found some useful information to get away with VisualAge compiler.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 845 | Replies: 9
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC