Author Topic: Compiling the source in Windows  (Read 55543 times)

Zulfi.Ali

  • Guest
Re: Compiling the source in Windows
« Reply #15 on: July 14, 2010, 11:07:26 PM »
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

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Compiling the source in Windows
« Reply #16 on: July 14, 2010, 11:23:32 PM »
Quote
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
Code: [Select]
#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: [Select]
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.
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.

Zulfi.Ali

  • Guest
Re: Compiling the source in Windows
« Reply #17 on: July 15, 2010, 02:38:46 AM »
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

  • Guest
Re: Compiling the source in Windows
« Reply #18 on: July 29, 2010, 02:29:05 AM »
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

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Compiling the source in Windows
« Reply #19 on: July 29, 2010, 02:01:47 PM »
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.

« Last Edit: July 29, 2010, 05:11:24 PM by support »

Verhas

  • Guest
Re: Compiling the source in Windows
« Reply #20 on: August 01, 2010, 07:31:46 AM »
Quote
Use "a[100]" as the variable name (example array variable) with this function and see if it works.

It does not. It is not supposed to work that way. Do not try to access arrays from the embedding applications. Instead of pass binary strings as I explained in another comment and then write a small BASIC fragment that converts the string to the format you want. The PACK and UNPACK function and commands are your friends doing that.