11
What's New / Re: ScriptBasic Core Windows 32 bit - Embedding
« Last post by Support on May 25, 2021, 04:27:04 PM »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.
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>
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";
- scriba_SetFileName(pProgram, "none");
- 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>