gnu.gcc.help
[Top] [All Lists]

Re: Shared Library in C,C++,PRO *C

Subject: Re: Shared Library in C,C++,PRO *C
From: "chets"
Date: 24 Jul 2006 00:16:01 -0700
Newsgroups: gnu.gcc.help
Thanks Michael
Yes you are correct we need to pre-compile the PRO *C program to
equivalent C/C++ code. That I am doing, means I am able to generate
equivalent C/C++ code. So now I am giving you the steps of making my
shared library with linkage options:-

proc iname=abc.pc sqlcheck=full code=cpp user=scott/tiger@mydb
g++ -fPIC -g -c abc.c -I/oracle/precomp/public -I/oracle/rdbms/demo
-I/oracle/rdbms/public -L/oracle/lib /oracle/precomp/lib/cobsqlintf.o
-lclntsh `cat /oracle/lib/sysliblist` -lm

g++ -shared -o abc.so abc.o

g++ -o EXECUTE test.c -ldl

Now if I run by  ./EXECUTE. It gives me following runtime error:-

./ EXECUTE: undefined symbol: fun

Moreover I am taking care of  all the C linkage while compiling by
putting them as extern "C".

Kindly solve the problem if possible.

Michael Mair wrote:
> chets schrieb:
> >     I created a shared library for a PRO *C program abc.pc as abc.so. I
> > want to use function fun() written inside this program using
> > dlopen(),dlsym() etc in another program test.c working on linux.Then at
> > dlsym it gives me dlerror() saying "./test: undefined symbol: fun".
> > Probably it is not able to resolve the symbol name "fun" from the
> > shared library.Hence if possible help me to resolve this problem.
>
> I am no expert in PRO*C. My understanding is the following:
> Embedded SQL is compiled in two steps.
> First, the precompiler replaces all SQL statements in the C or C++ Code
> with appropriate SQL runtime calls. The results is 100% C or C++ which
> is then compiled with a C or C++ compiler.
>
> Are you able to generate a C or C++ programme with embedded SQL, i.e.
> without shared library?
>
> If yes: How did you link your C or C++ modules into a shared library
> (give us the linker line)?
>
> Another potential problem: Are you trying to combine C and C++ without
> having declared C linkage?
>
> Cheers
>   Michael
> -- 
> E-Mail: Mine is an   /at/ gmx /dot/ de   address.


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy