[1196] in java-interest

home help back first fref pref prev next nref lref last post

Re: example of calling native c++

daemon@ATHENA.MIT.EDU (Jeff White)
Fri Aug 25 18:11:16 1995

From: Jeff White <jsw@cs.brown.edu>
Date: Fri, 25 Aug 1995 14:58:18 -0400
To: dswain@condor.citi.doc.ca
In-Reply-To: <9508251842.AA10534@corb.ccrit>
Reply-To: jsw@cs.brown.edu
CC: java-interest@java.sun.com


>>>>> "Duncan" == Duncan Swain <dswain@condor.citi.doc.ca> writes:

    >> extern "C" { void demo_Hello_printhello(struct Hdemo_Hello
    >> *blah); #include "javaString.h" #include "demo_Hello.h" }

    Duncan> My problems arise when I try to get Inventor headers into
    Duncan> the extern "C" statement:

    Duncan> "/opt/OpenInventor/include/Inventor/SbString.h", line 128:
    Duncan> Error: Only one of a set of overloaded functions can be
    Duncan> "C" or "Pascal".

You can't put c++ headers that have method overloading inside of an
extern "C"  statement.  

    Duncan> If I leave the inventor headers outside the extern "C"
    Duncan> statement, I get errors when my native library is loaded
    Duncan> at runtime:

Yes, the inventor headers need to be put outside of the extern "C"
statement.  But your actual native functions that get called (that in
turn call the inventor functions) need to be inside (or their
declaration) the extern 'C" statement.  

If you're still having problems, let me know.  I've done some stuff
with java->inventor specifically and got it to work.  

Hope this makes sense.  It was hell trying to get it to work myself.

good luck,
jeff

 --------------------------------------------------------------------
| Jeff White jsw@cs.brown.edu http://www.cs.brown.edu/people/jsw/    |
| "So you run and you run to catch up with the sun but it's sinking  |
| Racing around to come up behind you again" - pink floyd            |
 --------------------------------------------------------------------
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post