|
H.6 Calling Procedures Written in Other Languages
|
Sheerpower can call procedures written in other programming languages as long as
they are contained in a DLL as a global routine. An example of this is
calling routines in the Microsoft provided
msvcrt.dll library.
The
call statement is used to call and execute library routines. These
routines can perform procedures so the programmer does not have to write the
code from scratch.
The library to which the routine belongs must have been specified in a
library statement.
Routines within a DLL are called using the
call statement, followed by a quoted
string which contains the name of the routine to be called:
Some routines take arguments. By default, most arguments are passed by their
value. Strings and arrays are always passed by reference. If you want to
explicitly pass an argument by reference (the pointer to the argument), use
the
by ref option:
a% = 45
call 'my_routine (myvar% by ref, myarray%() by ref)
After a routine is called, it might also return a value.
_integer will
contain that value.
The example below uses the Microsoft provided
msvcrt.dll library and
calls the
strlen function/routine.