[2263] in java-interest

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

Re: calling native C/C++ : portability

daemon@ATHENA.MIT.EDU (Eric Barna)
Wed Sep 27 15:01:24 1995

From: Eric Barna <ebarna@teachersoft.com>
To: fsuarez@ll.iac.es
Date: Tue, 26 Sep 1995 15:58:43 ()
Cc: java-interest@java.Eng.Sun.COM


>  To: java-interest-digest@java

Next time, mail to "java-interest@java", okay?

>  I know JAVA uses extern "C" to include C code. 

There is no 'extern "C"' facility in Java.  Developers who want to access
external C++ code need to use 'extern "C"' in their C++ code so that the
method names aren't changed by the C++ compiler. 

>  But I wonder if that restricts the resulting program portability. 

Accessing external certainly restricts both portability and ease of
distribution (shared libraries aren't automatically downloaded from a
web page the way Java classes are).  We strongly discourage using native 
methods if you want to write applets or portable programs.  

>  How does Java implement extern "C"?

It doesn't -- most current C++ compilers do.

>  Are the C code translated to bytecodes?

No, the C code must be linked into a shared library, also called a DLL
on Windows systems.  This file must be present when the application is
run, and must be dynamically loaded by the application prior to its use.
Only Java code is translated into bytecodes.

Tom
-
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