This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Library problem in jni.cc on Linux


Hi!
I need some helping hand on this:

I try to link native methods to be statically linked into an executable on Linux.

This does not work. I used --whole-archive, but that only ensures, that the
needed methods are linked into the executable, which is a good thing.
Then i thought, that --export-dynamic would be good and used that, too.

The real problem seems to be the final line
return lt_dlsym (NULL, symname);
inside java/lang/natRuntime.cc:74

I thought, that would search symname inside the executable, but this is not
the case: The first executable instruction of lt_dlsym inside
libltdl/ltdl.c:1663 is this:

if (!handle)
{
 last_error = LT_DLSTRERROR(INVALID_HANDLE);
 return 0; 
}

So the call in natRuntime.cc is a pure nop.

Unfortunately, i do not have any clue, how to correct this.
I assume, the executable has to be added to the libraries list
using add_library but i do not know, when and how this should be done.
(java::lang::Runtime::init? lt_dlinit?)

Please give me some hints.
Thanks in advance,
Martin

-- 
The early bird gets the worm. If you want something else for       
breakfast, get up later.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]