This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: Calling java code from C/C++ code.
- To: "'twall at oculustech dot com'" <twall at oculustech dot com>, "Boehm, Hans" <hans_boehm at hp dot com>
- Subject: RE: Calling java code from C/C++ code.
- From: "Boehm, Hans" <hans_boehm at hp dot com>
- Date: Mon, 5 Mar 2001 14:03:20 -0800
- Cc: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>, java at gcc dot gnu dot org
It's essential that when the gc is loaded, the weak reference to data_start
be bound to the definition from the main executable.
The dlopen man page vaguely implies that this might happen if you link the
main program with "-rdynamic", which I couldn't find on the ld man page.
Probably the easiest workaround is to explicitly link against the GC library
instead of using dlopen to load it. A GNU ld expert might be able to
suggest better solutions.
Hans
> -----Original Message-----
> From: Timothy Wall [mailto:twall@oculustech.com]
> Sent: Monday, March 05, 2001 1:49 PM
> To: Boehm, Hans
> Cc: Bryce McKinlay; java@gcc.gnu.org
> Subject: Re: Calling java code from C/C++ code.
>
>
> This is linux x86, RedHat 7.0, using gcc 3.0 branch from CVS,
> and binutils
> from the distribution. The java code is very simple:
>
> public class test {
> public static void execute() {
> main(new String[0]);
> }
> public static void main(String[] args) {
> System.out.println("Hello, world");
> System.exit(0);
> }
> }
>
> I believe dlopen loads the gc, using LD_LIBRARY_PATH to find
> it. I have no
> idea how that affects the weak references.
>
> Tim
>
> "Boehm, Hans" wrote:
>
> > > -----Original Message-----
> > > From: Timothy Wall [mailto:twall@oculustech.com]
> > > (gdb) p GC_dump()
> > > ***Static roots:
> > > From 0x0 to 0x804a1d8
> > >
> > ...
> > There's the problem. The collector thinks that static data
> for the main
> > program starts at location 0, and hence it's trying to scan
> memory from 0x0
> > to 0x804a1d8. Most of that isn't mapped.
> >
> > I assume your gcj installation works with a simple 100%
> Java program? This
> > is Linux/X86? Which distribution?
> >
> > Does the garbage collector itself get loaded with a dlopen?
> Does that
> > affect processing of the weak references to __data_start
> and data_start?
> >
> > Hans
>