My objective is to embed it in MS VC7 desktop application
You don't have to recompile the 2.1 source to embed ScriptBasic in your application.
Here is a BCX example that might get you started.
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 Scriptcmd = command()
PRINT "ARG = ",cmd,"\n"
for x=1 to 10
print x,"\n"
next x
ResultsC:\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.
The library named as a parameter in a $LIBRARY statement will be linked to the program without the need, at link time, to specify explicitly, on the command line or in a makefile, the library.
$LIBRARY is an alias to the C compiler "#pragma lib" feature. $LIBRARY operates on the same level as #INCLUDE and will emit the appropriate library statements within the header section of the emitted C source code.