Presentation is loading. Please wait.

Presentation is loading. Please wait.

C++/Java/COM Interoperability

Similar presentations


Presentation on theme: "C++/Java/COM Interoperability"— Presentation transcript:

1 C++/Java/COM Interoperability
Paul Werbicki Supervisor: Dr. Rob Kremer Department of Computer Science University of Calgary

2 Agenda Background Thesis Conclusion Problem Statement
Statement of Work Why? How? Scope of Work Conclusion

3 Background C++ Mature language that bridges low-level performance and object-oriented programming in a high-level language. Widely used in commercial software development. Java Relatively young language that provides cross-platform software development using an extensive platform API. Ideal for the development of research and commercial APIs.

4 Background Component Object Model (COM)
Microsoft/DEC solution to allow software objects created by different developers/vendors to interact with one another. COM defines a binary interface for sharing reusable software components. Used extensively in all Microsoft development tools and productivity software.

5 Thesis – Problem Statement
How can software written in one language be used in another language? Specifically, how can software written in Java be used in other programming languages such as C++, Visual Basic, Perl, or Javascript? To what level is it possible to integrate Java with other programming languages, and what limitations currently exist?

6 Thesis – Statement of Work
I propose creating a library that will allow Java classes to be created and used in C++ and COM-compatible programming languages. Using this library I intend to study, in a non-trivial example, what limitations exist in object-oriented language and component-based language interoperability.

7 Thesis – Why? Application are being built with “off-the-shelf” parts.
Choice of programming language limits interoperability. Maintaining the same software in multiple languages is costly.

8 Thesis – Why? Different programming languages are used for purposes.
C++ widely used for commercial applications due to its robustness and performance. Visual Basic is popular for internal applications due to its rapid GUI development. Researchers/Vendors choose Java for APIs due to its cross-platform capabilities.

9 Thesis – Why? By encapsulating Java inside of another programming language, developers can re-use existing cross-platform code, while taking advantage of the platform specific features of other languages. Examples: Visual Basic GUI with Java business objects. Speedy computations in C++ with a Java cross-platform communications library.

10 Thesis – How? Create a library that uses the JNI to encapsulates the JVM. Provide a proxy-generating program for C++. Integrate the library with COM to allow COM-compatible languages to directly access objects.

11 Thesis – How?

12 Thesis – How? C++ Proxy classes will be generated as C++ header files.
Stub functions will use the library to interface with Java and marshall parameters between C++ and Java. Proxies will allow class inheritance with certain limitations (no private/public/protected or virtual functions).

13 Thesis – How? Component Object Model
Using COM interfaces, compatible languages will be able to directly access Java objects. Example code (see Chap. 4 for more info): Dim objJavaVM As JavaCOM.JVM Dim objDate As Object Dim strTest As String Set objJavaVM = CreateObject(“JavaCOM.JVM”) Call objJavaVM.Initialize(“”) Set objDate = objJavaVM.CreateObject(“java.lang.Date”) MsgBox “Date= “ & objDate.toString()

14 Thesis - Scope of Work One-way integration:
Only C++ or COM-compatible languages calling Java will be supported. Future work: Java calling C++ objects or objects written in COM-compatible languages. Development will be specific to the Windows operating system due to COM dependencies. Future work: Full inheritance of Java from C++ (currently a limitation of the JVM).

15 Conclusion Interoperability library allow integration of Java into many different types of projects. Complex C++ programs to simple Javascript scripts can take advantage of existing Java code. Java-based APIs are more appealing to developers if they are not forced to use Java.


Download ppt "C++/Java/COM Interoperability"

Similar presentations


Ads by Google