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]

Re: Calling java code from C/C++ code.


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 ]


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