How to call newLisp functions in DLL but not using Eval
Posted: Tue Nov 11, 2008 11:05 am
Hi,
I'm working on a framework and I need to call newLisp code. My problem is I need to call functions in a very fast way (I'm trying to use newLisp in a game framework).
Ok, I will try to be more clear:
1) I open newlisp.dll
2) I get a reference to newlispEvalStr
3) First phase: I evaluate a big script to let newLisp compile it (newlispEvalStr(...my big script...).
4) Second phase: I need to call the functions I already stored in the previous step. So for example I need: newlispEvalStr("(calc-sum 1 2 3 4 5)") and imagine that the function calc-sum was previously stored/compiled in the DLL in the point 3-first phase.
Well, my problem is step 4 (second phase) must be called at runtime, when my game is running, so it could run at 60 calls per second (at least).
When I use newlispEvalStr, newLisp precompile the code everytime I use it. Instead it could be useful a function (similar to newlispEvalStr) but to call a newLisp function directly, without recompilation (like newLisp interpreter do).
I could even use pointers, etc... to get references to such functions. And consider I need only to call functions (maybe in namespaces).
This is very important for me, since performance are a key-point in a gaming system.
One thing more: don't care about the programing language I use, in fact I could adapt any example you have. Now I'm working in Pure Basic (but even C or Pascal/Delphi is good for me).
Thank you for your help!
Can you help me?
I'm working on a framework and I need to call newLisp code. My problem is I need to call functions in a very fast way (I'm trying to use newLisp in a game framework).
Ok, I will try to be more clear:
1) I open newlisp.dll
2) I get a reference to newlispEvalStr
3) First phase: I evaluate a big script to let newLisp compile it (newlispEvalStr(...my big script...).
4) Second phase: I need to call the functions I already stored in the previous step. So for example I need: newlispEvalStr("(calc-sum 1 2 3 4 5)") and imagine that the function calc-sum was previously stored/compiled in the DLL in the point 3-first phase.
Well, my problem is step 4 (second phase) must be called at runtime, when my game is running, so it could run at 60 calls per second (at least).
When I use newlispEvalStr, newLisp precompile the code everytime I use it. Instead it could be useful a function (similar to newlispEvalStr) but to call a newLisp function directly, without recompilation (like newLisp interpreter do).
I could even use pointers, etc... to get references to such functions. And consider I need only to call functions (maybe in namespaces).
This is very important for me, since performance are a key-point in a gaming system.
One thing more: don't care about the programing language I use, in fact I could adapt any example you have. Now I'm working in Pure Basic (but even C or Pascal/Delphi is good for me).
Thank you for your help!
Can you help me?