Using Java objects from C++
Bryce McKinlay
mckinlay@redhat.com
Tue May 4 15:13:00 GMT 2004
Dave Menendez wrote:
>Would I simply have a structure which could contain, among other things,
>one or more Java pointers, and instead of using malloc, I would use
>GC_malloc_uncollectable? Then I assume when I'm done with the struct, I
>just call GC_free with the struct's address, and I don't have to do
>anything specific with the Java pointers themselves (they'll get
>collected later if no other references are found by the GC).
>>
Thats right.
>And a final question I have is how I get access to
>GC_malloc_uncollectable and GC_free. I see they are macros in
>boehm-gc/include/gc.h, but the boehm-gc header files were not installed
>with the rest of GCC. Did I configure GCC incorrectly?
>>
We don't install that header - the functions in gc.h arn't a public
interface for libjava, so you're going through the "back door" if you
rely on the GC_* functions. You'll have to install the header by hand or
perhaps just inline the GC_malloc_uncollectable/GC_free declaration into
your code.
Regards
Bryce
More information about the Java
mailing list