ScriptBasic

Support => Source => Topic started by: paopao on June 26, 2007, 05:45:36 PM

Title: Compiling the source in Windows
Post by: paopao on June 26, 2007, 05:45:36 PM
Hello everybody,

this is my first post and I'd like some help to compile Script Basic source.

I have generated all the header files (.h) as requested, with headerer.pl.

Now  I would like to try to compile scriba.c and I try using either Dev C++ or Visual C++ 6. I can't find any project file so I simply open scriba.c and I try to compile it.

In Dev C++ I get a lot of unreference messages such as:

  [Linker error] undefined reference to `alloc_InitSegment'
  [Linker error] undefined reference to `alloc_Alloc'

for example.

What can I do to sort it out? Is there someone, who can help me please?

Thanks a lot!
Roberto
Title: Compiling the source in Windows
Post by: Support on June 27, 2007, 12:48:56 AM
Roberto,

Make sure you have Perl installed and run setup.cmd from the source directory in a console window.


John
Title: Compiling the source in Windows
Post by: paopao on June 28, 2007, 08:33:59 PM
Hallo John,

first thanks for your reply. I still have to introduce myself but currently I am pretty busy with personal things...

About compiling Script Basic, I tried with setup.cmd from Windows XP but I get the following message:

"The jamal module esd.pm is not installed..."

Where can I find jamal and esd.pm? I tried here: http://peter.verhas.com/progs/perl/jamal/ but the download page is unavailable.

Also, please, if I want to compile scriba.c, could you give me a list of all files to be included in the project?

Thanks,
Roberto

Quote from: "support"
Roberto,

Make sure you have Perl installed and run setup.cmd from the source directory in a console window.


John
Title: Compiling the source in Windows
Post by: Support on June 29, 2007, 08:39:01 PM
I just put the 2.1 binaries in the "What's New" section to download. I will have the 2.1 source up soon.

John
Title: Compiling the source in Windows
Post by: paopao on July 01, 2007, 07:15:13 PM
Hi John,

thanks for your replies.

I downloaded the binaries and source code for 2.1.

I have installed jamal.pl, checked the path for the compiler (I currently have free bcc55, vc++ 6 and dev c++) because nmake did not work but when running setup.cmd I still have problems as reported below:

NMAKE : fatal error U1077: 'cl' : return code '0x2'

when using makefile, for every .c file, I also get:

basext.c (just a sample file) : fatal error c1034: stdio.h: no include path set

it looks to me that scriba.exe, sbhttpd.exe, libdscriba.lib and all modules are not created/compiled.

Any advice, help you can offer?

Thanks a lot,
Roberto
Title: Compiling the source in Windows
Post by: Support on July 02, 2007, 01:25:49 AM
I assume your trying to compile under Windows XP?

Peter (author) compiled the distribution under VS7 if I remember correctly.

try setup --NT on your command line.


John
Title: Compiling the source in Windows
Post by: paopao on July 02, 2007, 01:00:33 PM
Hi John,

well thanks again for your support.

Yes, I have Win XP and VS6. I guess it should compile with not so many hassles :)

I checked and checked the messages I was getting.

The first were about nmake and I downloaded it from MS, then I realised I had it in my VS folder but it was not being executed and it also looked as some files could not be included because their path was not set.

At least I realised that for an unknown reason some variables and paths were not set properly so I used VCVARS32.BAT and things improved a lot.

Some modules cannot be compiled yet but I got scriba.exe and other files in the bin folder.

I'm trying to compile scribacmd. Once again I realised I should include libscriba.lib in the link tab and it looks to me that some functions cannot be called yet (scriba_SetFileName for example). Am I missing something?

By the way, if I may ask you, how do you use ScriptBasic? Embedded in your software or how? Have you added some commands, compiled some source? It would be useful to have some sample projects or part of them in the forum.

As soon as I get some samples working fine and all times I will be more than happy to post mine here.

See you,
Roberto

P.S. Btw there is no need for the --NT option as setup.cmd has only one line: perl setup.pl --nt %*
Title: Compiling the source in Windows
Post by: Support on July 02, 2007, 03:02:50 PM
I use ScriptBasic scripts on my Linux box to talk to a real estate (MLS) web service to get listing and photo data.

I'm currently working on a Aestiva HTMLOS conversion to the ScriptBasic Application Server. (sbhttpd w/Apache interface)

You might try to get your hands on VS7 and try the compile as that is what the make files are setup for.

BTW: The 2.1 release has everything compiled and ready to run for Windows. Unless you need to enhance the Basic, compiling the source isn't a requirement.

John
Title: Compiling the source in Windows
Post by: Marcel on October 30, 2007, 12:54:01 PM
Hi,

I'm curious how the project is evolving.
Title: Compiling the source in Windows
Post by: Support on October 30, 2007, 12:58:27 PM
ScriptBasic is a mature / stable offering. It has 10 years of hard work invested by the author. I use it exclusively for all my utility scripting and web projects.

I think you will be very happy with ScriptBasic.


John
Title: Compiling the source in Windows
Post by: Marcel on October 30, 2007, 01:36:08 PM
Hi John,

Thanks for the reply. I was more curious what Roberto made of it. I saw he mentioned some C compilers and read also that Perl is involved.  :(

At the moment I have VS2005  C/C++, VB.Net but I 'like' Pelles C as program more than the VS2005 C.

Does the compiler brand matter in this case?
Is it possible to by-pass the Perl stage?
Title: Compiling the source in Windows
Post by: Support on October 30, 2007, 01:43:01 PM
Perl is only use as a 'helper' to get ScriptBasic code compiled. Once you have a working ScriptBasic environment, Perl is no longer needed.  It's used for things like taking the source text files and converting the <CR><LF> to <LF> if your compiling the source under *nix.

John
Title: Compiling the source in Windows
Post by: Marcel on October 30, 2007, 03:12:08 PM
Ok, I'm not on linux, so you say that Perl isn't needed on Windows? I first need to dive into the Window info  :)

Thanks so far John.
Title: Re: Compiling the source in Windows
Post by: Zulfi.Ali on July 13, 2010, 08:08:03 PM
Hi,

I have recently downloaded the latest version i.e. 3.0 of ScriptBasic and I find that it is very different from 2.1.  There are no setup.cmd and headerer.pl files etc.

My objective is to embed it in MS VC7 desktop application but even after reading all the forums and documentation, I still am clueless as to how to proceed.  I tried to create a new project along the lines of scribacmd.c but when I included the function scriba_new(), the linker gave the following error.

error LNK2019: unresolved external symbol _scriba_new referenced in function "public: void __thiscall CScriptBasicEmbDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CScriptBasicEmbDlg@@QAEXXZ)   ScriptBasicEmbDlg.obj   

I would really appreciate if someone could provide a little help in this regard

Thanks
Zulfiqar
Title: Re: Compiling the source in Windows
Post by: Support on July 13, 2010, 08:42:07 PM
Welcome to the ScriptBasic forum Zulfiqar.

The ScriptBasic 3.0 Windows version is using MinGW/GCC as the C compiler. If your using the MS VC7 compiler, I suggest that you use the 2.1 version of ScriptBasic. The 3.0 release is focused on a new make file system and using MinGW/GCC for 32/64 compiling.

NOTE: Don't mix libs compiled using different compilers. (linkers complain) VC7 will have the same problem using MinGW/GCC compiled libs. Accessing DLLs compiled by any of the compilers doesn't seem to be an issue.

Title: Re: Compiling the source in Windows
Post by: Zulfi.Ali 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
Title: Re: Compiling the source in Windows
Post by: Support 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.
Title: Re: Compiling the source in Windows
Post by: Zulfi.Ali 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!
Title: Re: Compiling the source in Windows
Post by: Zulfi.Ali 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
Title: Re: Compiling the source in Windows
Post by: Support 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.

Title: Re: Compiling the source in Windows
Post by: Verhas 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.