Calling java code from C/C++ code.

Bryce McKinlay bryce@albatross.co.nz
Tue Feb 27 13:14:00 GMT 2001


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 ]


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /