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: Bryce McKinlay <bryce at albatross dot co dot nz>
- Subject: Re: Calling java code from C/C++ code.
- From: Timothy Wall <twall at oculustech dot com>
- Date: Fri, 02 Mar 2001 14:34:29 -0500
- CC: tromey at redhat dot com, java at gcc dot gnu dot org
- Organization: Oculus Technologies
- References: <3A9BE61C.3F2936FC@cygnus.com> <87u25grna6.fsf@creche.redhat.com> <3A9BFC3A.800ADB7C@oculustech.com> <3A9C18C6.DA0EF9E4@albatross.co.nz>
- Reply-To: twall at oculustech dot com
I tried the patch but apparently it didn't apply cleanly to Class.h. Can you
post the correct Class constructors?
thansk
Tim
Bryce McKinlay wrote:
> Timothy Wall wrote:
>
> > The C++ wrapper code looks simliar to what gcj generates as a
> > "main"wrapper, I load this object and the one from the above code:
> >
> > extern const char **_Jv_Compiler_Properties;
> > extern void JvRunMain(struct Class*, int, char**);
> > static const char *props[] = { 0 |;
> > extern struct Class _CL_4test;
> > extern "C" int callable(void)
> > {
> > _Jv_Compiler_Properties = props;
> > JvRunMain (&_CL_4test, 0, 0);
> > return 0;
> > }
> >
> > So in effect, I'm invoking the java "main" (which is ok). However, the
> > dlopen fails in the static initializers as previously described.
>
> I ran in to this problem recently while trying to dlopen() libgcj with
> sprof for profiling purposes. Hans thought that the problem may be that
> static initializers (some of which allocate) where being run while the list
> of shared libraries were in an inconsistent state, because the dlopen was
> in progress.
>
> So, I wrote a patch to remove all the static initializers from libgcj. It
> still didn't allow me to profile (There seems to be another problem. I can
> profile the GC, and arbitrary Java .so's, but not libgcj itself. Weird.),
> but I'd be interested to know if it helps in your case.
>
> http://gcc.gnu.org/ml/java/2001-01/msg00594.html
>
> regards
>
> [ bryce ]