Shared libaries


 
Thread Tools Search this Thread
Operating Systems Linux Shared libaries
# 1  
Old 06-19-2008
Shared libaries

Hi all
i am trying to implement a shared library an my system and follow the following steps
I created two files and created object files
gcc -fPIC -c file1.c
gcc -fPIC -c file2.c

Now when i tried to create a shared library i am receiving different results when i try to use various options that i have seen implemented across various examples of shared libraries.Sometimes it is creating an executable a.out.

I finally managed to create library mystuff.so.1.1 by following command
gcc -shared -WI,-soname,mystuff.so -o mystuff.so.1.1 file1.o file2.o -lc;

but i am receiving both environmental variables LD_LIBRARY_PATH as well as LD_PRELOAD as null.I am logged in on KDE.

I can't understand what is happening in entire procedure

Thanks for any assistance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

A former shared filesystem which is not available

ggod morning, i need your helo, there is a hp_ux server named XYZ, somebody told me there was a shared network file system which was used for several tasks but now its not avalibale, but he doesnt remain which was the name of the machine which it it had this FS. evnthouh in a file called fstab... (2 Replies)
Discussion started by: alexcol
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. 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

5. UNIX and Linux Applications

Linking Libaries to binary executable

Hello, I am using Open Suse 10.3. I have implemented Zeroconf and the program is working with out any errors. Libray linking for normal executable: gcc -o name name.c -lavahi-client.so (WORKING) Now i have to create a binary executable, to have the program running on a device. For a... (0 Replies)
Discussion started by: bhavana
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. Programming

help with shared memory

what i want to do is have an int that can been written into by 2 processes but my code doesn't seem to work. #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> #include<stdio.h> #define KEY1 (1492) int main() { int shmid; volatile int * addr;... (6 Replies)
Discussion started by: ddx08
6 Replies

8. UNIX for Advanced & Expert Users

shared library

What is the primary difference between static library and dynamic library? and how to write static shared library? (1 Reply)
Discussion started by: areef4u
1 Replies

9. Programming

Can FD's be shared between threads?

Hello, Can a FD (file desc.) from a pipe(...); call be shared between a thread? / Henrik (2 Replies)
Discussion started by: ne2000
2 Replies

10. 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
Login or Register to Ask a Question
klcc(1) 							  H. Peter Anvin							   klcc(1)

NAME
klcc - compile a program against klibc SYNOPSIS
klcc [gcc options] [-o outfile] infile... DESCRIPTION
klcc is a wrapper around gcc(1) and ld(1) which compiles and links a program against the klibc tiny C library. It supports most gcc options. Unlike gcc, klcc compiles with optimization on by default. Furthermore, the optimization level used depends on whether or not -g is speci- fied, since klcc frequently uses options in the normal case which makes debugging impossible. Therefore, compile without -g, -O, -f or -m option to use the default optimization level; this will generally result in the smallest binaries. You may want to use -s when linking, however. Use -O0 to compile without any optimization whatsoever; this may not work depending on the version of gcc used. -nostdinc allows to turn off klibc include files. Use the -shared or -static option to compile for and link against shared or static klibc. Note that shared klibc only supports running against the exact same klibc binary as the binary was linked with. In addition to standard gcc options, klcc supports options of the form -print-klibc-option, which prints the corresponding klibc configura- tion option. AUTHOR
Written by H. Peter Anvin <hpa@zytor.com>. COPYRIGHT
Copyright (C) 2005 H. Peter Anvin - All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER- CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SEE ALSO
gcc(1) klibc 1 March 2005 klcc(1)