Summary

 < Day Day Up > 



This chapter showed you how to use C++ with different programming languages. The three different programming languages used included C, assembly, and Java.

The extern 'C' language linkage specification is used to link C language routines with C++ programs. The distinction between C and C++ function names is necessary due to C++ name mangling. If a C function declaration omits the extern 'C' linkage specification then the C++ compiler will not be able to resolve the mangled function name with the non-mangled name found in the C library file. Other high-level languages can be used with C++ by using the extern language linkage specification. Consult your development environment documentation for details.

The two primary methods of using assembly language with C++ programs include using inline assembly instructions within a C++ function, or by creating stand-alone object modules with assembly language and linking those object modules to C++ projects. Consult your compiler documentation to learn how it supports the asm keyword or other inline assembly methods.

C++ can be used to write functions that target specific hardware platforms. These native functions can be called from a Java program using the Java Native Interface. Most of the steps involved in creating a JNI program are portable across computing platforms with the exception of how the native dynamic link library is created and how it is named. As with everything else in this chapter, consult your development environment documentation for details on how to create a dynamic link library that can be loaded by a Java program to support the Java Native Interface.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net