[plt-scheme] Using the Foreign Language Interface.

From: Zukowski, Steven D (Steven_Zukowski at student.uml.edu)
Date: Wed Dec 10 14:04:48 EST 2008

I'm having issues with the Foreign Language Libraries and using them to get at some C++ functions. Essentially my scheme program wants to pass a string to a C++ function that has this signature: double Value_Of_Expr(const string &Expr). I compiled the C++ progame into a DLL using g++ using this: g++ -shared -o fn.dll fn.cpp, but Im not sure if this is correct, it's just what some help website said to do, but I don't know if it is doing it correctly or not. I then try to load the created dll using schemes foreign language library functions: (ffi-lib fn.dll), but this crashes scheme and I have to manually shut down the program. I have tried loading the Value_of_Expr() function using (get-ffi-obj) but the documentation on the docs is lost on me, I can't follow it.

Can anyone help me solve this issue?

To state it hopefully a bit more clearly:
I am trying to interact with a dll I compiled using g++ -shared -o fn.dll fn.cpp.
I need to get at the double Value_Of_Expr(const string &Expr) function inside that file and pass it a string from scheme.
I then need to retrieve a returned number from the function.
I am unsure how to do any of this really ><

~Steve Z
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20081210/8cac21a9/attachment.html>

Posted on the users mailing list.