21
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 11, 2024, 10:35:38 PM »I think I'm getting closer to pinning down the problem. I added a SB_hello function to the extension module that doesn't require any arguments be passed. It runs a SB script that has the wrapped REPLACE() as a function. These are the same calls I'm making with the SBT API functions with argument passing not fixed code. So it seems something isn't working correctly passing arguments to the extension module.
sbfunctions
Output
C:\ScriptBasic64\examples>scriba sbt_min.sb
Goodbye World
C:\ScriptBasic64\examples>
Code: ScriptBasic
- IMPORT sbt.bas
- SBT::SB_hello()
Code: C
- besFUNCTION(SB_hello)
- DIM pSbProgram AS pProgram;
- DIM pSbData AS ArgData;
- DIM unsigned long AS fnsn;
- DIM SbData AS FunctionResult;
- scriba_SetFileName(pProgram, "sbfunctions");
- scriba_LoadSourceProgram(pProgram);
- scriba_Run(pProgram, "");
- ArgData = scriba_NewSbArgs(pProgram,"s s s i i", "Hello World", "Hello", "Goodbye", 1, 1);
- fnsn = scriba_LookupFunctionByName(pProgram, "main::sb_replace");
- scriba_CallArgEx(pProgram, fnsn, AT FunctionResult, 5, ArgData);
- PRINT("%s\n", FunctionResult.v.s);
- scriba_destroy(pProgram);
- besRETURNVALUE = NULL;
- besEND
sbfunctions
Code: ScriptBasic
- ' sbfunctions - ScriptBasic CBASIC function wrappers
- FUNCTION sb_replace(basestr, searchstr, replacestr, occurances, startpos)
- sb_replace = REPLACE(basestr, searchstr, replacestr, occurances, startpos)
- END FUNCTION
Output
C:\ScriptBasic64\examples>scriba sbt_min.sb
Goodbye World
C:\ScriptBasic64\examples>