BASIC Developer & Support Resources > Scripting Languages

ScriptBasic Core Windows 32 bit Install

<< < (3/3)

John:
Here is my Hello World for ScriptBasic embedding. I typically IMPORT the script resources I need for the project as a source string for ScriptBasic to run.


--- Code: C ---// gcc for_embed.c -I C:\\sbgcc\\source ..\\lib\\libscriba.dll -lpthread -o for_embed #include <stdio.h>#include <stdlib.h>#include <string.h>#include <getopt.h>#include "scriba.h" int main (int argc, char** argv){  pSbProgram pProgram;  char src[] = "FOR i = 1 TO 5\nPRINT i,\"\\n\"\nNEXT\n";   pProgram = scriba_new(malloc,free);  scriba_SetFileName(pProgram, "none");  scriba_LoadProgramString(pProgram, src, strlen(src));  scriba_Run(pProgram, "");    scriba_destroy(pProgram);   return(0);}   

C:\sb_build\examples>gcc for_embed.c -I C:\\sbgcc\\source ..\\lib\\libscriba.dll -lpthread -o for_embed

C:\sb_build\examples>for_embed
1
2
3
4
5

C:\sb_build\examples>

Navigation

[0] Message Index

[*] Previous page

Go to full version