943,929 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 978
  • C RSS
Nov 28th, 2008
0

c shared libraries

Expand Post »
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
Similar Threads
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Nov 28th, 2008
0

Re: c shared libraries

come on guys, at least tell me a tutorial that teaches shared libraries in c on unix os.
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Nov 28th, 2008
0

Re: c shared libraries

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)
Reputation Points: 749
Solved Threads: 134
Practically a Master Poster
StuXYZ is offline Offline
660 posts
since Nov 2008
Dec 1st, 2008
0

Re: c shared libraries

maybe because i use not unix but aix that command does not executes on my os.
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Dec 1st, 2008
0

Re: c shared libraries

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Dec 2nd, 2008
0

Re: c shared libraries

Click to Expand / Collapse  Quote originally posted by Salem ...
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?
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Dec 3rd, 2008
0

Re: c shared libraries

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Dec 3rd, 2008
0

Re: c shared libraries

Click to Expand / Collapse  Quote originally posted by Salem ...
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.
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Dec 3rd, 2008
0

Re: c shared libraries

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..
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Dec 3rd, 2008
0

Re: c shared libraries

Anyway thank you Salem, i found some useful information to get away with VisualAge compiler.
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Replace using POSIX regular expressions
Next Thread in C Forum Timeline: Need Graphics in C...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC