[1078] in java-interest

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

Re: Calling Native C++ functions

daemon@ATHENA.MIT.EDU (Thomas Ball)
Fri Aug 18 01:48:34 1995

Date: Thu, 17 Aug 1995 11:18:09 -0700
From: Thomas.Ball@eng.sun.com (Thomas Ball)
To: ibalkhi@dnt.dialog.com
Cc: java-interest@java.Eng.Sun.COM

If you surround your C++ code with 'extern "C"', it turns off the C++
name-mangler so that you can reference functions by the names used in
your source file:

extern "C" {

	void HelloWorld(void) {
		cout << "Hello, world.\n";
	}

} // extern "C"

You can therefore use the exact same recipe as with native C functions.

Accessing C++ objects and their member functions from Java is more
difficult.  While technically possible, it ties you to a particular C++
implementation, since you need to reach under the C++ runtime's hood.
Most C++ vendors reserve the right to change their runtime designs, so
you can even get stuck just using a different version of a compiler.  
We therefore can't provide any support for this usage.

Tom

>  From daemon@java  Thu Aug 17 10:52:56 1995
>  To: java-interest@java
>  Subject: Calling Native C++ functions
>  X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
>  
>  Hi Everybody,
>  
>  I am a new member of Java family. I need some help on how to call native C++ member functions from Java. I did tried calling native c functions and it did work out pretty good. I would appreciate, if somebody can give me a working example of calling C++ functions.
>  
>  Thank's
>  Imran 
>  -
>  Note to Sun employees: this is an EXTERNAL mailing list!
>  Info: send 'help' to java-interest-request@java.sun.com
>  
-
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