User Tools

Site Tools


guide:help:scsdllpascalsyntax

Pascal syntax

Documentation | Help File | Scripter Studio | Calling dll functions | Pascal syntax

function function_name( arguments ) : result_type ; calling_convention ; external 'libName.dll' name external_function_name ;

For example, the following declaration:

function MyFunction( arg : integer ) : integer ; external 'CustomLib.dll' ;

imports a function called MyFunction from CustomLib.dll. Default calling convention, if not specified, is register. Scripter Studio also allows to declare a different calling convention (stdcall, register, pascal, cdecl or safecall) and to use a different name for DLL function, like the following declaration:

function MessageBox( hwnd : pointer ; text, caption : String ; msgtype : Integer ) : Integer ; stdcall ;external 'User32.dll' name 'MessageBoxA' ;

The above function imports function MessageBoxA from User32.dll (Windows API library), and names it MessageBox for usage in script.

Declaration above can be used for functions and procedures (routines without result value).

2018/05/23 13:58

Page Tools