Support > Source

Compiling the source in Windows

<< < (4/5) > >>

Zulfi.Ali:
Hi,

I have downloaded v2.1 and tried compiling the source but I keep getting errors.  The sample message is as follows

C:\ScriptBasic\source>setup.cmd
This is NT cwd=C:\ScriptBasic\source\
creating configure.jim
Trying to find out where the Borland compiler is installed (if installed)
creating subdirectories for compilation output files
compiling Makefile using the Jamal preprocessor
running syntaxer.pl to generate the syntax defintion C language tables from synt
ax.def
running generrh.pl to generate the error messages from errors.def
running lmt_make.pl for all lmt*.def files
scanning all subdirectories to find all C source files
there are 4492 files in the source tree
there are 123 C source files in the source tree
configuring module bdb

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\bin\c
l.EXE"' : return code '0xc0000135'
Stop.
This is NT cwd=C:\ScriptBasic\source\
executing headerer for the C files
 extracting header from interface.c
creating the module object directory
Processing jamal files creating makefile.vc7
Processing jamal files creating makefile.bcc
Compiling the module executing modmake.cmd
ERROR: The module did not compile
configuring module cgi

I even tried to use the precompiled library in a new project but the linker complained that it was unable to open it.  Help needed!!

Zulfiqar

Support:

--- Quote ---My objective is to embed it in MS VC7 desktop application
--- End quote ---

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

--- Code: ---#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)

--- End code ---

ScriptBasic Script

--- Code: ---cmd = command()

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

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

--- End code ---

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.

--- Quote from: BCX docs ---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.

--- End quote ---

Zulfi.Ali:
Yes!! Finally managed to get it working!!

I too had the impression that I should not be recompiling the source to embed it... Eventually I figured out that the library path was incorrect due to which the linker could not open the lib...

Thanks for your help... I will be returning for more assistance as this is just the beginning... let me play around it a bit first!

Zulfi.Ali:
Hi

Can you provide a debug version of the compiled library as I need to figure out how arrays are being addressed... I need it to find a solution for the array initialization problem that I am facing.

Thanks

Support:
Have you tried to get the array contents by using the scriba_LookupVariableByName() function to get the serial number of the variable contents you're looking for?

Use "a[100]" as the variable name (example array variable) with this function and see if it works. I sent Peter Verhas a e-mail asking if he could shed some light on this for you.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version