BCX-32 ScriptBasic Embedded Example

John Spikowski
Sat Aug 29 17:25:30 PDT 2009


List,

I was able to get the Windows version of libscriba.dll to work with BCX-32
and the Pelles C compiler. I would like to thank Armando Rivera and Ian
Casey for their assistance in making this work with BCX.

<<< BCX Windows Interpreter - bi.bas >>>

#include "\scriptbasic\source\scriba.h"
#include "\scriptbasic\source\getopt.h"

$LIBRARY "libscriba.lib"

Global pProgram as pSbProgram
Global iError as int

pProgram = scriba_new(malloc,free)

scriba_LoadConfiguration(pProgram,"c:\scriptbasic\bin\scriba.conf")

scriba_SetFileName(pProgram, Command$(1))
scriba_LoadSourceProgram(pProgram)

iError=scriba_Run(pProgram,Command$(2))

scriba_destroy(pProgram)


<<< ScriptBasic Script >>>
Code:

cmd = command()

PRINT "ARG = ",cmd,"\n"

for x=1 to 10
print x,"\n"
next x


<<< Results >>>

C:\Program Files\BCX\sb>bi E01.bas JRS
ARG = JRS
1
2
3
4
5
6
7
8
9
10

C:\Program Files\BCX\sb>

Note:  The $LIBRARY "libscriba.lib" line is used to make the OS aware at
runtime of the entry points of the exported functions in libscriba.dll when
called by the executable. The bi.exe is 19KB.

bcx-bi_win.zip
bi.bas
bi.C
bi.exe
E01.bas
libscriba.dll
libscriba.exp
libscriba.lib
lscriba.lib

http://www.allbasic.info/forum/index.php?topic=730.msg2552#msg2552


John


           



More information about the BCX mailing list