11-05-2002
Thank you very much for your help, I think I've got it now.
For the record ,this is a simple example of how I did it:
1) Create ut.c with the func to include in the lib
int F1( int i) {
printf("Print Nš = %d\n", i);
}
2) Complie ut.c to create ut.o
cc -c ut.c
3) Create Lib from ut.o
ar r libut.a ut.o
4) Create t1.c to invoke the func in lib
void main ( int argc, char *argv[]) {
int i_in;
if ( argc != 2) {
printf( "Wrong parameters, use : t1 <nš> \n");
return;
}
i_in = atoi( argv[1]);
F1( i_in);
}
5) Complie t1 linking it to the lib created in 3)
cc -o t1 t1.c -L: libut.a
And it Works :
>t1 69
Print Nš = 69
10 More Discussions You Might Find Interesting
1. Programming
I need to load a dynamic library from a statically linked program. Is there a way without recompiling my program.
when i try to do that my program just crashes.
If not possible, how can I avoid crashing the program when i try to load the dynamic lib, again without recompiling.
If my... (1 Reply)
Discussion started by: disclaimer
1 Replies
2. Programming
Aloha,
I'm attempting to use a C program to create directories and then use a system call to have another program write .dat files into that directory. I understand that I could use the "system("mkdir directory_name")" function however, I would like my program to create a new directory each time... (3 Replies)
Discussion started by: aloha_boi
3 Replies
3. Programming
Hi ,
I want to create a new user using c program not with unix adduser command .
is it possible to write a cprogram to create a new user account , it should accept username , grouid , group name and all other privilages .
i can use system calls inside c program to do this .
i will... (5 Replies)
Discussion started by: naren_chella
5 Replies
4. Shell Programming and Scripting
Hi,
I inherited a .lib file that I need to use to make a .dll file from a c++ file. I am able to do this in visual studio but I can not do this using cygwin. I would like to build the dll using the commandline in order to create a make file. Can someone help me. I would really appreciate it.
... (0 Replies)
Discussion started by: lsoleyma
0 Replies
5. Programming
I could not recall the function in C to generate diff type of sounds.
Can somebody help me out. (2 Replies)
Discussion started by: bishweshwar
2 Replies
6. Shell Programming and Scripting
Hi Guru,s/Geek,s
I need help to create RPM names from rpms.
Example :
a2ps-4.14-6.fc10.i386
perl-Email-Find-0.10-2.fc10.noarch
directfb-1.2.7-2.fc10.i386
libid3tag-0.15.1b-7.fc10.i386
apr-util-1.3.7-1.fc10.i386
libquicktime-1.0.3-4.fc10.i386
The Desired Output is :
a2ps... (2 Replies)
Discussion started by: anand.linux1984
2 Replies
7. Red Hat
Hello,
I'm experimenting a problem on my rh server.
Red Hat Enterprise Linux AS release 3 (Taroon Update 8)
2.4.21-47.ELsmp #1 SMP i686 i686 i386 GNU/Linux
It started with a segmentation fault on
#id root
To resolve it, I've installed
coreutils-4.5.3-28.4.i386.rpm
But, I... (6 Replies)
Discussion started by: gogol_bordello
6 Replies
8. Programming
for example, I have a static lib name liba.a
it offers some interface such a1();a2();
but i do not have the source code of liba.a;
If i would like to create a shared object, and offer the similar interface of
a1 and a2;
Is there a way to fulfill such requirement?
thanks. (7 Replies)
Discussion started by: flost
7 Replies
9. Homework & Coursework Questions
I need help program in C... :create a program that runs two processes linked oven (1 Reply)
Discussion started by: gizmo16
1 Replies
10. Shell Programming and Scripting
To understand SUID feature, I set SUID bit for a SHELL script.
Then I executed the program by a different user.
In order to understand how it works, I tried different ways like:
1) I didn't give execute permission for the other user (not an owner) and then he tried to execute it.
2) I... (15 Replies)
Discussion started by: ravisingh
15 Replies
LIGCC(1) Listaller Project LIGCC(1)
NAME
ligcc - Wrapper around gcc to create more portable apps
SYNOPSIS
ligcc [OPTION ...]
DESCRIPTION
This manual page documents briefly the ligcc command.
ligcc is a wrapper around gcc. It allows you to create more portable executables by doing three things:
o Forces the linker to link against older glibc symbols. Users who are using an older version of glibc will no longer get "undefined
symbol GLIBC_2.4 in /lib/libc.so"-style error messages.
o Allows you to easily statically link to any other library.
o Automatically removes bogus dependancies. For example, your program uses libfoo. libfoo uses libpng internally, but your app does not.
Yet the pkg-config file for libfoo specifies "-lfoo -lpng" is linker parameters. And tadaa - you now have a bogus dependancy on libpng!
LiGCC automatically removes the -lpng for you if your app doesn't use libpng directly.
o Add $ORIGIN/../lib to the binary's library search path. $ORIGIN is the directory in which the binary exists. This ensures that your
binary can find library dependencies which are placed in the 'lib' folder under the same prefix. You might want to install custom
libraries into /lib. If you set $APBUILD_PROJECTNAME, ligcc will also add $ORIGIN/../lib/$APBUILD_PROJECTNAME to the library search
path.
OPTIONS
See the manpage of gcc(1) for more information about possible options.
There are also several environment variables available to modify ligcc's behavior check the documentation for more information.
SEE ALSO
lig++ (1), gcc(1).
Additional documentation can be found on http://listaller.tenstral.net.
AUTHOR
This manual page was written by Matthias Klumpp matthias@tenstral.net.
COPYRIGHT
Copyright (C) 2009-2012 Matthias Klumpp
Listaller Project 20 April,2012 LIGCC(1)