Release chipmunk as a DLL

Discuss new features and future development.

Release chipmunk as a DLL

Postby savior » Tue Jan 01, 2008 5:31 pm

Hi, I'd like to ask for releasing chipmunk as a standalone windows DLL, with C-like interface (only functions declared), for making easier the usage in other languages that aren't C and C++.

Yes, I am aware of pymunk that ships with a DLL, but it would be nice to have an oficial release as dll.

Or, does anyone have a step-by-step instructions how can I build chipmunk as DLL? I'm not used to do this, since my background in C is little.

Thank you.
savior
 
Posts: 8
Joined: Tue Jan 01, 2008 5:24 pm

Re: Release chipmunk as a DLL

Postby slembcke » Tue Jan 01, 2008 10:05 pm

I'd be happy to host them if people are willing to build them for me. I only have the means to compile on OS X at the moment.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Release chipmunk as a DLL

Postby savior » Wed Jan 02, 2008 9:01 am

If there's anyone out there who could help me build it as a dll, with some free compilers, like gcc, or even vc++, I could do it.
savior
 
Posts: 8
Joined: Tue Jan 01, 2008 5:24 pm

Re: Release chipmunk as a DLL

Postby Android_X » Wed Jan 02, 2008 3:43 pm

Hello,

Currently I've managed to compile a working DLL using chipmunk-4.0.2, MSYS, MinGW (gcc) and the commands below (which I put in a shell script and ran while working in the src directory).
Just as a note, this is the first DLL I've ever compiled and I'm a newbie at C/C++ so I hope it helps but use at your own risk.
Code: Select all
gcc -O3 -ffast-math -std=gnu99 -fPIC -c cp*.c
gcc -O3 -ffast-math -std=gnu99 -fPIC -c chipmunk.c
gcc -shared -o chipmunk-4.0.2.dll -Wl,--out-implib=chipmunk-4.0.2.dll.a -Wl,--output-def=chipmunk-4.0.2.dll.def cp*.o chipmunk.o

rm -f ./*.o

edit: added -O3 -ffast-math

I have attached a zip file with the DLL in case it's of use to anyone (updated: compiled with -O3 -ffast-math).

Regards, AX
Last edited by Android_X on Wed Jan 02, 2008 4:51 pm, edited 1 time in total.
Android_X
 
Posts: 18
Joined: Wed Oct 31, 2007 7:55 pm

Re: Release chipmunk as a DLL

Postby slembcke » Wed Jan 02, 2008 4:09 pm

You should add -O3 -ffast-math to your compiler flags. That should make it much faster.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Release chipmunk as a DLL

Postby Android_X » Wed Jan 02, 2008 4:56 pm

Ah yes, it runs much faster now :D. I've updated my previous post and attached the new faster DLL.
Thank you!
Android_X
 
Posts: 18
Joined: Wed Oct 31, 2007 7:55 pm

Re: Release chipmunk as a DLL

Postby savior » Sat Jan 05, 2008 1:46 pm

Wow, thank you very very much, Android!

I've managed to compile it using Dev-C++'s gcc, however, I haven't tested the dll, because first I'll need to translate the headers.

Thank you again!

If anyone wants to compile it with Dev-C++, get it from the site http://www.bloodshed.net/devcpp.html get version 5, and put this in the \src\ directory, as a bat file:

Code: Select all
SET PATH=C:\Dev-Cpp\bin
gcc -O3 -ffast-math -std=gnu99 -fPIC -c cp*.c
gcc -O3 -ffast-math -std=gnu99 -fPIC -c chipmunk.c
gcc -shared -o chipmunk-4.0.2.dll -Wl,--out-implib=chipmunk-4.0.2.dll.a -Wl,--output-def=chipmunk-4.0.2.dll.def cp*.o chipmunk.o


Wait, and it will compile the DLL.

It will only give some warnings, saying:
warining: -fPIC ignored for target (all code is position independent)

And that's it!

Thank you very much for your help.
savior
 
Posts: 8
Joined: Tue Jan 01, 2008 5:24 pm


Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron