Mailing List Archive

Problem embedding C++ code
Hi,

I am trying to write a wrapper around a library written in C++ and I am
running into lots of problems.

I am running Python 1.5.2 on SunOS 5.5.1 (compiled with SUN's cc and
linked with Sun's CC)

The wrapper is written in a file called link-wrap.c and currently it
contains only one very simple function.

CC -c -KPIC link-wrap.c -I/home/mdeshpan/SW/include/python1.5
"link-wrap.c", line 13: Warning: String literal converted to char* in
formal argument 1 in call to Py_BuildValue(char*, ...).
1 Warning(s) detected.
CC -G link-wrap.o -lapic -lpthread -o link.so

libapic.so is the library which I am trying to write the wrapper for,
it was compiled using Sun's CC compiler

when I try to import link module in python I get the following error..

daffy:~/Swig$python
Python 1.5.2 (#3, Jun 29 1999, 11:17:23) [C] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import link
Traceback (innermost last):
File "<stdin>", line 1, in ?
ImportError: ld.so.1: python: fatal: relocation error: file
./libapic.so: symbol _ex_rethrow_q: referenced symbol not found

any help would be greatly appreciated..

Thanks in advance

Mukund


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Problem embedding C++ code [ In reply to ]
From: mukundd@my-deja.com

Hi,

I am trying to write a wrapper around a library written in C++ and I am
running into lots of problems.

I am running Python 1.5.2 on SunOS 5.5.1 (compiled with SUN's cc and
linked with Sun's CC)

The wrapper is written in a file called link-wrap.c and currently it
contains only one very simple function.

CC -c -KPIC link-wrap.c -I/home/mdeshpan/SW/include/python1.5
"link-wrap.c", line 13: Warning: String literal converted to char* in
formal argument 1 in call to Py_BuildValue(char*, ...).
1 Warning(s) detected.
CC -G link-wrap.o -lapic -lpthread -o link.so

libapic.so is the library which I am trying to write the wrapper for,
it was compiled using Sun's CC compiler

when I try to import link module in python I get the following error..

daffy:~/Swig$python
Python 1.5.2 (#3, Jun 29 1999, 11:17:23) [C] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import link
Traceback (innermost last):
File "<stdin>", line 1, in ?
ImportError: ld.so.1: python: fatal: relocation error: file
./libapic.so: symbol _ex_rethrow_q: referenced symbol not found

any help would be greatly appreciated..

Thanks in advance

Mukund


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Problem embedding C++ code [ In reply to ]
From: Alex <alex@somewhere.round.here>


I had this problem a while back. It went away when we made everything
that gets included a shared library. That included the C++ library, I
think... it was on linux, and I think we had to include libg++.so
instead of libg++.a.

HTH, and good luck.
Alex.

> CC -c -KPIC link-wrap.c -I/home/mdeshpan/SW/include/python1.5
> "link-wrap.c", line 13: Warning: String literal converted to char* in
> formal argument 1 in call to Py_BuildValue(char*, ...).
> 1 Warning(s) detected.
> CC -G link-wrap.o -lapic -lpthread -o link.so
> daffy:~/Swig$python
> Python 1.5.2 (#3, Jun 29 1999, 11:17:23) [C] on sunos5
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import link
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> ImportError: ld.so.1: python: fatal: relocation error: file
> ./libapic.so: symbol _ex_rethrow_q: referenced symbol not found

This is a gratuitous signature, included so that the news server won't
complain that I've got more included text than new text. Snappy, huh?
Problem embedding C++ code [ In reply to ]
I had this problem a while back. It went away when we made everything
that gets included a shared library. That included the C++ library, I
think... it was on linux, and I think we had to include libg++.so
instead of libg++.a.

HTH, and good luck.
Alex.

> CC -c -KPIC link-wrap.c -I/home/mdeshpan/SW/include/python1.5
> "link-wrap.c", line 13: Warning: String literal converted to char* in
> formal argument 1 in call to Py_BuildValue(char*, ...).
> 1 Warning(s) detected.
> CC -G link-wrap.o -lapic -lpthread -o link.so
> daffy:~/Swig$python
> Python 1.5.2 (#3, Jun 29 1999, 11:17:23) [C] on sunos5
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import link
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> ImportError: ld.so.1: python: fatal: relocation error: file
> ./libapic.so: symbol _ex_rethrow_q: referenced symbol not found

This is a gratuitous signature, included so that the news server won't
complain that I've got more included text than new text. Snappy, huh?