Sam Lantinga wrote:
BTW, I’ve been asked for Java support, so if anyone knows anything about
integrating Java and C/C++ applications, please let me know!
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software
Well I hacked this message up pretty good ^o^.
Anyway, to interface C/C++ and Java (Pre 1.2, don’t know if anything changed), it’s a textbook step procedure.
Step 1: Write the wrapper class (Java) for the code, it does’nt have to do anything really, but it has to have all of it’s member functions in place.
Step 2: Run the javah program on the class created in step 1, it’ll spit out a header. Javah will require some addition arguments to generate new style headers (in 1.1 it was -jni). The header it spits out will have some requirements, all of these are in java’s include directory.
Step 3: Fill out the functions created in the header that was created by javah in step 2. Compile the code and create a library file (dynamically linkable, -G under *NIXS) Big thing here is to remember to put the library into the same directory that LD_LIBRARY_PATH points too.
As long as the native code library created contains just ansi C/C++ and plain SDL calls it should work on any SDL/Java compatible enviroment.
-Phoenix Kokido______________________________________________________
Get your free web-based email at http://www.xoom.com
Birthday? Anniversary? Send FREE animated greeting
cards for any occassion at http://greetings.xoom.com
Pheonix Kokido wrote:
Sam Lantinga wrote:
BTW, I’ve been asked for Java support, so if anyone knows anything about
integrating Java and C/C++ applications, please let me know!
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software
Well I hacked this message up pretty good ^o^.
Anyway, to interface C/C++ and Java (Pre 1.2, don’t know if anything changed), it’s a textbook step procedure.
Step 1: Write the wrapper class (Java) for the code, it does’nt have to do anything really, but it has to have all of it’s member functions in place.
Step 2: Run the javah program on the class created in step 1, it’ll spit out a header. Javah will require some addition arguments to generate new style headers (in 1.1 it was -jni). The header it spits out will have some requirements, all of these are in java’s include directory.
Step 3: Fill out the functions created in the header that was created by javah in step 2. Compile the code and create a library file (dynamically linkable, -G under *NIXS) Big thing here is to remember to put the library into the same directory that LD_LIBRARY_PATH points too.
As long as the native code library created contains just ansi C/C++ and plain SDL calls it should work on any SDL/Java compatible enviroment.
-Phoenix Kokido
Get your free web-based email at http://www.xoom.com
Birthday? Anniversary? Send FREE animated greeting
cards for any occassion at http://greetings.xoom.com
If you like I can send you an example, for Visual C++ and JDK 1.1.3.
I believe there is not problems with other architectures.
Grettings
Alberto J. Fernandez
If you like I can send you an example, for Visual C++ and JDK 1.1.3.
I believe there is not problems with other architectures.
That would be great.
Please send it to my private e-mail: slouken at devolution.com
Thanks!
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/