Hi all,
I am developing an application in Tcl, inwhich i have to load many modules written in C. I am converting those C modules into shared object\(.so\) files, and wrap it with my application using SWIG, for which i had the interface file.
Now my question is, i have two different .so files, let me name it as (prog1.so) and (prog2.so). My prog1.so contains 5 functions and my prog2.so contains 3 functions.
If i load prog1.so file individually in tclsh shell, i can able to call the functions available in prog1.so. Similarly for prog2.so also. But i want to call all the functions available in both the prog1.so and prog2.so .
Can Anyone help me to sort this problem out !!!!!!!!!!!!!!!!!!!!!!!!!!!
Here is the procedure what i did. kindly correct me if i did something wrong.
step 1:
------
I have the "prog1.c" file and interface file "prog1.i " and creating a wrapper code for it using the command
$ swig -tcl prog1.i
This will give me "prog1_wrap.c" which is a wrapper code for my C program.
step 2:
------
Now i compile the prog1.c and prog1_wrap.c using the following command
$ gcc -fPIC -c prog1.c prog1_wrap.c -I /usr/local/include
This will give me prog1.o and prog1_wrap.o files.
step 3:
------
Now i create a prog1.so file using the following command
$ gcc -shared prog1.o prog1_wrap.o -o prog1.so
step 4:
------
Here i will go to the tclsh shell and Load the \(.so\) file.
% load ./prog1.so prog1
This will load the file and i can able to call the function available in prog1.c
++++++++++++++++++++++++++++++++++++++++++++++++++++++
I can do the same for any no.of programs individually. But if i try to combine shared object files of two programs i can't able to load it in tclsh shell.
I tried with the following commands to merge the (.so) files, I doesnt know whether it make sense.
-
$ gcc -shared prog1.so prog2.so -o combine.so
-
$ gcc -shared prog1.o prog1_wrap.o prog2.o prog2_wrap.o -o combine.so
I hope these where not correct method to merge a two different shared object file.
I am Expecting your Valuable suggestions!!!
Thanks in Advance.
Regards,
Kumar.