Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Tue Sep 26, 2017 5:45 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Odyncomp.... how to C++?
PostPosted: Tue Dec 15, 2009 11:33 pm 
Offline

Joined: Thu Oct 09, 2008 5:49 pm
Posts: 69
Hello! I know that Raydium is made in only C to be compliant with multiple platforms... ie Mac and Windows etc and C++

I normally use "./odyncomp <filename>" to compile apps..
I need to include C++ code inside my application.

The most I know about command line compilation is "gcc <filename> -o <output>"
but how do I compile raydium appli with C++ code in it??

I studied odyncomp and.... had no luck :oops:

so how to compile a C++ raydium application?? :D

(perhaps odyncomp could include a flag for this? e.g. "./odyncomp <filename> -cpp" -cpp being to use C++ compiler??

EDIT: Please disregard this! I have found solution to my problem without using C++... Thank you!


Top
 Profile  
 
PostPosted: Thu Dec 17, 2009 8:01 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
If you've found a solution, it could be a good idea to explain it so that people searching the same thing as can see it ... :)

Anyway, if someone interested, the "official" solution is to define "CC" environment variable:

Code:
export CC=g++
./odyncomp.sh skell.cpp


Top
 Profile  
 
PostPosted: Sat Dec 19, 2009 9:21 pm 
Offline

Joined: Thu Oct 09, 2008 5:49 pm
Posts: 69
Xfennec wrote:
the "official" solution is to define "CC" environment variable:

Code:
export CC=g++
./odyncomp.sh skell.cpp


Thank you Xfennec! :D
My way was to open odyncomp.sh and add a line "CC=g++;"
buut... your way works much better.

Now I have question, compiling a raydium app with c++
this seems to be a big error:
Code:
error:   initializing argument 1 of ‘void raydium_callback(void*)’

every other error I have gotten past...
is raydiuym_callback() compatible in this situation? is there another function?


On a side note... (with my weird adventures of coding languages...) are the python bindings currently supported in Raydium? or where those for a much older version of Raydium and just left there until someone fix?

Thank you very much :D


Top
 Profile  
 
PostPosted: Sun Dec 20, 2009 11:26 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
C++ is much more strict about types than C language. It means you'll have to cast a lot of things, since Raydium is a bit lazy on this side. For instance, you'll have to do the following thing:
Code:
raydium_callback((void*)&display);

Same will apply with most callbacks, and probably strings (Raydium use "char *", where C++ is providing "const char *" [I think] for static strings)

About Python (and Java) bindings, they're official and supported, no problem. The following steps will do the trick:
Code:
php gen_bindings.php --python
gcc -g -Wall -O2 -shared raydium/swig/raydium_wrap.c -o raydium/swig/_raydium.so ... (use the provided command line and change Python paths according your distribution)
cd raydium/swig/
./test.py


Note: you should update to rev 946, since I've just fixed a few things about bindings, thanks to you post ;)


Top
 Profile  
 
PostPosted: Sat Dec 26, 2009 5:50 am 
Offline

Joined: Thu Oct 09, 2008 5:49 pm
Posts: 69
Sorry for late reply.

Xfennec the patch works great! Thank you! :P

Side note for anyone else trying to create bindings...: for newer versions of php (if gen_bindings.php just "displays everything") you need to wrap the php tags in the script correctly.. like so:
<?php>
--start
--code here--
end--
?>

annd I may post some other helpful tips later.


Top
 Profile  
 
PostPosted: Sat Jan 09, 2010 4:57 am 
Offline

Joined: Thu Oct 09, 2008 5:49 pm
Posts: 69
Hi,

Python bindings work great, I like them alots.

I am able to compile them on Linux Ok.
I am trying to compile on Windows (I have little experience with Windows)

I am having trouble finding the right gcc args to use.

If someone could try to compile on Windows using windows SDK and give me help please?

(Windows is hard to use.... :cry: )


Top
 Profile  
 
PostPosted: Sat Jan 09, 2010 1:49 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,


Running gen_bindings only add raydium.i in swig directory.

But i can't find a raydium_wrap.c file anywhere.

Any idea ?

Have a nice day
Ouille


Top
 Profile  
 
PostPosted: Sat Jan 09, 2010 8:01 pm 
Offline

Joined: Thu Oct 09, 2008 5:49 pm
Posts: 69
ouille wrote:
Hello,


Running gen_bindings only add raydium.i in swig directory.

But i can't find a raydium_wrap.c file anywhere.

Any idea ?

Have a nice day
Ouille


Yes. raydium.i is a Swig file..
So you need to get Swig Windows executable here:
http://sourceforge.net/projects/swig/files/swigwin/swigwin-1.3.40/swigwin-1.3.40.zip/download

and then run from terminal > swig <and then use python option> -python <and then input file> raydium.i
End command line will look like:

swig -python raydium.i

It will generate raydium_wrap.c Compiling is another fun thing I've yet to find out how to do :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group