ScriptBasic

Support => General Discussions => Topic started by: Ken Arck on January 22, 2012, 11:22:16 AM

Title: Running an outside call?
Post by: Ken Arck on January 22, 2012, 11:22:16 AM
Is there anyway to call a binary from within Scriba (Linux)?
Title: Re: Running an outside call?
Post by: Support on January 22, 2012, 11:31:12 AM
Is there anyway to call a binary from within Scriba (Linux)?

Do you mean call an external library function in a shared object? (.so)

ScriptBasic has a nice extension module API that makes extending the language rather easy. The API is composed of macros that allows wrapping an external library with very few lines of code.

The Windows version of ScriptBasic has an extension module called DYC that will let you call generic DLLs. Under Linux I use GTK-Server as my FFI interface.


Title: Re: Running an outside call?
Post by: Ken Arck on January 22, 2012, 11:39:05 AM
I mean lets say (as an example only) that I want to call a compiled binary in /usr/local/bin from within a Scriba program and then return to the Scriba program and continue onward
Title: Re: Running an outside call?
Post by: Support on January 22, 2012, 11:46:38 AM
Ken,

When you say CALL, I assume you mean calling a function in a script or an external library. If you mean execute a system or external executable, (program) then ScriptBasic supports two methods.

EXECUTE (http://www.scriptbasic.org/docs/ug/ug_25.49.html) - can wait for the external program to finish.

SYSTEM (http://www.scriptbasic.org/docs/ug/ug_25.171.html) - start an external program in a separate process in asynchronous mode

John
Title: Re: Running an outside call?
Post by: Ken Arck on January 22, 2012, 11:48:30 AM
Excellent, thank you!

(I was looking though the documentation searching for the wrong keywords!)