Creating a shared Libary ?


 
Thread Tools Search this Thread
Top Forums Programming Creating a shared Libary ?
# 1  
Old 07-15-2005
Question Creating a shared Libary ?

hi,
I am trying to build a shared libary to overwrite some standard c functions (malloc etc), now i get the following error:

my system is AIX 5.2

Code:
gcc -fPIC -g -c -Wall mycfile.c

so far so good .o file created--> mycfile.o
now building the .a or .so libary (.a or .so ?? i am not sure which file type ist has to be)
Code:
gcc -shared -WI,-soname,libmystuff.so.1 -o libmystuff.so.1.0.1 mycfile.o -lc -ldl
ld: 0706-005 Cannot find or open file: libmystuff.so.1
        ld:open(): A file or directory in the path name does not exist.
collect2: ld returned 255 exit status

Why is he trying to open libmystuff.so.1 ?? he should create it!

what am i doing wrong?

Lazzar
# 2  
Old 07-20-2005
Can you try this:
Specify the path where you can find the library libmystuff.so.1 with -L during the linking.

Hope it helps...
# 3  
Old 07-21-2005
ldd helps with finding out executable dependencies. Also the command nm helps with linkage problems.
On solaris x86 i have created a shared library in the following manner.
gcc -o libname.so -G prog1.c prog2.c...
then to use the dynamic lib i do the following:
gcc -o progtest progtest.c -L libpath -lname.so and -R for runtime linker library search.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Creating a .profile, displaying system variables, and creating an alias

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is what I am supposed to do, word for word from my assignment page: 1. Create/modify and print a... (2 Replies)
Discussion started by: Jagst3r21
2 Replies

2. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies

3. AIX

Shared FS

I am working on project that need shared access to the FS from 2 AIX HACMP nodes. This FS is created on a SAN disk and the VG that includes this FS is active on node A. What options do I have so that this FS can also be accessed from Node B ? We don't have GPFS, so that is not a option.... (3 Replies)
Discussion started by: mk8570
3 Replies

4. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

5. Programming

Shared memory for shared library

I am writing a shared library in Linux (but compatible with other UNIXes) and I want to allow multiple instances to share a piece of memory -- 1 byte is enough. What's the "best" way to do this? I want to optimize for speed and portability. Obviously, I'll have to worry about mutual exclusion. (0 Replies)
Discussion started by: otheus
0 Replies

6. Programming

Shared memory in shared library

I need to create a shared library to access an in memory DB. The DB is not huge, but big enough to make it cumbersome to carry around in every single process using the shared library. Luckily, it is pretty static information, so I don't need to worry much about synchronizing the data between... (12 Replies)
Discussion started by: DreamWarrior
12 Replies

7. AIX

Creating a shared filesystem

Hi everybody, Is it possible to create a Shared Filesystem on Network to be accessed from 2 Systems? Both systems are AIX but with different versions. One of these systems is AIX 4.3 & the other is AIX 5.2. Thanks in advanced (8 Replies)
Discussion started by: aldowsary
8 Replies

8. Linux

load error while creating shared library

Hi, I am trying to create shared library. When i run the script to build the library i get these errors ld: warning: option -o appears more than once, first setting taken ld: fatal: file libgc.so.0: open failed: No such file or directory ld: fatal: File processing errors. No output written... (0 Replies)
Discussion started by: masg1
0 Replies

9. Linux

Shared Libraries

How do i make a library shared say i have a library a.so which i have just compiled. I want to make it shared how do i make it Next Queation is what is the difference between a.so.0 a.so.1 a.so.2 & a.so :rolleyes: (1 Reply)
Discussion started by: wojtyla
1 Replies

10. UNIX for Dummies Questions & Answers

Shared Objects

Hi Friends ! I have a library, say libxyz.a. To view all the object files in the archive, i issued the command : ar -t libxyz.a which displayed all the object files it contains. Now, I would like to know the functions in each object file. Is there any such command that displays... (3 Replies)
Discussion started by: mrgubbala
3 Replies
Login or Register to Ask a Question