Here a small upgrade: I know many programming languages but I really love
newLisp, a scripting open source version of scheme (it's wonderful and really FAAST!).
newLisp home page: http://www.newlisp.org
Here a possible usage of your great package, using it inside a DLL (using newLisp scripting language and Pure Basic!):
Main code
Code: Select all
; Show the PureGDK render window
hDBWnd=OpenDBWnd(0,0,640,480,32,#GDK_Window_SystemMenu|#GDK_Window_ScreenCentered)
Delay(100)
OpenLibrary(0, "newlisp.dll")
startCode.s = "(import {my_dll.dll} {startEngine})"
startCode + "(import {my_dll.dll} {pause})"
startCode + "(import {my_dll.dll} {resume})"
startCode + "(import {my_dll.dll} {killThisThread})"
CallFunction(0, "newlispEvalStr", @startCode)
; Set the sync rate
dbSyncRate(0)
dbMakeObjectCube(1, 0.5)
CallFunction(0, "newlispEvalStr", @"(startEngine)")
Delay(2000)
CallFunction(0, "newlispEvalStr", @"(pause)")
Delay(2000)
CallFunction(0, "newlispEvalStr", @"(resume)")
Delay(2000)
CallFunction(0, "newlispEvalStr", @"(killThisThread)")
CloseLibrary(0)
Delay(100)
DLL
my_dll.dll is similar to my previous post, but I added a kill-thread function
Code: Select all
ProcedureDLL killThisThread()
KillThread(t1)
EndProcedure
What is happening here?
Well, I start PB application, and it will open my newLisp interpreter (newlisp.dll).
Then I will push in newLisp instance a small code to open my DLL "my_dll.dll" (see below) and get a reference to the functions inside:
Code: Select all
(import {my_dll.dll} {startEngine})
(import {my_dll.dll} {pause})
(import {my_dll.dll} {resume})
(import {my_dll.dll} {killThisThread})
Then I simply use my new DLL functions! It means I can use a 3D Game engine from my scripting language!
Possibilities are endless!!!
In order to use this program, simply download newLisp engine from the home page (
http://www.newlisp.org) then copy
newlisp.dll inside the same directory as this program and
my_dll.dll is running! That newLisp DLL is wonderful: only a simple dll to get all the power of newLisp in your pocket!
I hope this will help you!
