I am trying to use the Chipmunk physics library in Racket using the provided by FFI. However, I am currently having problems actually getting FFI to search for functions in the Chipmunk library, although it seems to load the library correctly.
I am using the latest version of Chipmunk (6.1.1) built into Windows 8 with Visual Studio 2008. I have set the "CHIPMUNK_FFI" flag to load the chipmunk_ffi.h file. I create the code in the Release DLL configuration using the "Multi-Threaded DLL" and "Build as dll" options. The Racket code I'm using looks like this:
(require ffi/unsafe
ffi/unsafe/define)
(define chipmunk (ffi-lib "./chipmunk"))
(define-ffi-definer define-chipmunk chipmunk)
(define _cpFloat _double)
(define cpFloat? real?)
(define _cpDataPointer _pointer)
(define _size_t _ulong)
(define _cpHashValue _size_t)
(define-cstruct _cpVect
([x _cpFloat]
[y _cpFloat]))
(define cpv
(get-ffi-obj "cpvadd" chipmunk (_fun _cpVect _cpVect -> _cpVect)))
And I get the error message:
ffi-obj: couldn't get "cpvadd" from "chipmunk.dll" (The specified procedure could not be found.; errno=127)
=== context ===
C:\Program Files (x86)\Racket\collects\ffi\unsafe.rkt:180:2: get-ffi-obj*
C:\Users\me.000\AppData\Roaming\Racket\planet\300\5.2.1\cache\jaymccarthy\chipmunk.plt\1\0\chipmunk-ffi-new.ss: [running body]
C:\Users\me.000\AppData\Roaming\Racket\planet\300\5.2.1\cache\jaymccarthy\chipmunk.plt\1\0\chipmunk-new.rkt: [traversing imports]
C:\Users\me.000\AppData\Roaming\Racket\planet\300\5.2.1\cache\jaymccarthy\chipmunk.plt\1\0\main.rkt: [traversing imports]
C:\Users\me.000\Dropbox\Code\workspace-racket\learning\main.rkt: [traversing imports]
Let me know if you need more information. I would really appreciate help on this.