Support > General Discussions
? about compiling C code produced with ScriptBasic
GSAC3:
SUPPORT:
I want to produce a WINDOWS compatible EXE file from a C code file produced with either SCRIBA 22b2 or 3.0.
Where can I find the correct set of compile and link command lines and correct LIB files to do this with either the Borland, MinGW32, or Pelles C compilers?
Based on the current development status, which version of ScriptBasic would be the best to use for this purpose?
Don
Support:
Hi Don,
Please use the Script BASIC 2.2 beta release for all your development. (see download board - sticky post) When using the scriba -Co new.c your.bas to create the C wrapper for the binary PCODE SB script, you are using libscriba.dll for your runtime support. This option creates small footprint executables sharing a common runtime. Send me an e-mail to support@scriptbasic.org and I will send you the latest source. You could use the 2.2 binaries and the 2.1 source (headers) as that is the only thing needed for the source and nothing has change in 2.2 with headers. I posted on the forum an example of compiling to C SB scripts. If you need further help, just ask.
As an alternative, you can create a standalone .exe of your script with the scriba -Eo new.exe your.bas . This option appends your binary tokenized script to the end of scriba.exe and renames it to the name given. Scriba always checks for an appended script before processing any of its command line options.
John
GSAC3:
John:
Thanks for your reply.
I wanted to try your "small footprint" EXE approach, but after looking at your SB2C post to see how it is done for WINDOWS, I am thoroughly confused. Your example seems to be for a system running LINUX whch I am totally unfamiliar with.
In your example you reference a "libscriba" which I can't fine anywhere in the SB22b2 distribution. Neither can I locate the "ibscriba.dll" you mentioned in your reply to my original message.
Can you please clarify?
Don
Support:
Don,
I'm still in the process of rebuilding my Linux system after it got trashed by a bad install script from a 3rd party library. Here is steps to compile a Script BASIC script to C under Ubuntu 14.04.1 LTS 64 bit. As soon as I get my XP virtualBox restored I post the Windows version of this.
--- Code: ---jrs@laptop:~/sb/sb22/test$ cat testlike.sb
t = "Text at the beginning <tag>OPEN</tag>just some text<tag>CLOSE</tag> text at the end"
IF t LIKE "*<tag>*</tag>*<tag>*</tag>*" THEN
PRINT JOKER(2),"\n"
PRINT JOKER(3),"\n"
PRINT JOKER(4),"\n"
ELSE
PRINT "No Match\n"
END IF
jrs@laptop:~/sb/sb22/test$ scriba -Co testlike.c testlike.sb
jrs@laptop:~/sb/sb22/test$ gcc -Os testlike.c -I /home/jrs/sb/scriptbasic/source /usr/lib/sb.a -lscriba -lm -lpthread -ldl -o testlike
jrs@laptop:~/sb/sb22/test$ ls -l testlike*
-rwxrwxr-x 1 jrs jrs 25813 Sep 30 18:23 testlike
-rw-rw-r-- 1 jrs jrs 8225 Sep 30 18:23 testlike.c
-rw------- 1 jrs jrs 233 Sep 24 11:06 testlike.sb
jrs@laptop:~/sb/sb22/test$ ./testlike
OPEN
just some text
CLOSE
jrs@laptop:~/sb/sb22/test$ file testlike
testlike: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=d0837f48122526833ddab760f8bdec3199efe4b9, not stripped
jrs@laptop:~/sb/sb22/test$
--- End code ---
Support:
Don,
Just received your e-mail. If you would like the current 2.2 source then download Dave's COM extension module, IDE/Debugger. The following is how to build the sb.a for use with the standalone method of compiling to C.
--- Code: ---ar rcs sb.a stndlone.obj report.obj myalloc.obj errcodes.obj dynlolib.obj
--- End code ---
FYI: Using this method allows you to static link your extension modules used for a more seamless end result.
Navigation
[0] Message Index
[#] Next page
Go to full version