Forums > Java

include c++ source files in a max external java project

September 4, 2010 | 5:08 pm

hi guys

I would like to add a c++ source file to a java max external project and call it in the main file..
do you guys know a way to do such a thing..

tiago morgado

September 5, 2010 | 6:39 am

You will need to rewrite the file. But not worries, from c++ to java is quite straight forward.

September 7, 2010 | 3:10 pm

You could also use the max messaging system (create a symbol in C++ and send messages to it from Java). This would of course require some knowledge of C++.

September 7, 2010 | 6:14 pm

I have not done it myself but know people who have: it is possible to create bindings to a compiled C library to call from your Java code. A quick google serach of "using c in java" seems to bring up some possibly helpful results.

September 7, 2010 | 9:18 pm

@Roth Indeed, this is possible using the Java Native Interface which allows a java to link to native code dynamically and vice versa. However, Max java objects already run inside a JVM created by Max. To communicate with Max externals you would need to send messages to symbols (see the SDK for details).

September 15, 2010 | 2:54 pm

@ Roth @ Hans Höglund – thank you so much for the helpful tips.. In fact I am creating a database of math expressions in order to optimize non-linear situations, etc. I’ve coded mandelbrot, fibonacci, etc. I will code some more fractals, I will code some graphs, maybe some system for balancing of permutations (I don’t know if you guys know something more specific about it).. and I want to pick up andré siers source code files in c++, from chaos-lib, in order, to include his externals in my database.. of course I will give him and the source code authors proper credit but there are actually a lot of work already done there.. and I would like to take advantage of it, once it is open source.. my object will probably be open source too

September 15, 2010 | 2:56 pm

so that I can then, use neural networks, to optimize all the values for the expressions, and drive them in non linear situations for generative purposes

Viewing 7 posts - 1 through 7 (of 7 total)