Problem with linking to shared native library

Andreas Bürgel Andreas.Buergel@web.de
Fri Mar 23 19:58:00 GMT 2007


Andreas BÃŒrgel schrieb:
> I've got a linking problem. Referencing a native C++ method in an shared library
> causes this error:
> 
> gcj  -O0 -g   --main=de.dbt.simplelibclient.SimpleCPPLib
> de/dbt/simplelibclient/SimpleCPPLib.o  -oDebug/SimpleLibClient   -LDebug
> -L/home/andreas/develop/projects/SimpleCPPLib/Debug -L../SimpleCPPLib/Debug
> -lSimpleCPPLib -lgcj
> de/dbt/simplelibclient/SimpleCPPLib.o:(.data+0xc): undefined reference to
> `hidden alias for de::dbt::simplelibclient::SimpleCPPLib::square(int)'
> de/dbt/simplelibclient/SimpleCPPLib.o:(.data+0x68): undefined reference to
> `hidden alias for de::dbt::simplelibclient::SimpleCPPLib::square(int)'
> collect2: ld returned 1 exit status

In the meantime I tested with a gcc 4.0.4 built from the release sources. With
this gcc version the executable builds fine without errors and runs as expected.
The other parts of my environment didn't change, so this looks like a problem of
gcc version > 4.0.4
I attached my current example also containing the output of failure build with
"gcc/gcj -v" (4.1.2) and "nm -C" of the shared lib.

-- 
Mit freundlichen Grueszen, / With kind regards,

  Andreas BÃŒrgel
  Diplom-Informatiker (Ingenieur-Informatik)
  Software-Engineer/-Architect
  http://www.andreas-buergel.de/profile.html

  Unbedingt lesenswerte Site:
  http://www.nachdenkseiten.de


  Entia non sunt multiplicanda sine necessitate.
                            -- William of Ockham
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simplecpplib_sample.tar.bz2
Type: application/x-bzip
Size: 18371 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20070323/4be9e8c8/attachment.bin>


More information about the Java mailing list