Situations may occur, when an external function need to be wrapped by a BDL function, e.g. if always the same modifications to a parameter must be done before the external function call.
Such a BDL function usually should behave like a real external function, which includes line and file reporting of the caller.
In order to make a wrapper function behave like an external, the function attribute <API_FUNCTION> must be specified.
dll "some.dll" "ApiFunc" function ApiFunc(in dstring optional); dclfunc function ApiFuncWrapper(theString : string optional) <API_FUNCTION> begin if StrIsEmpty(theString) then ApiFunc("default string"); else ApiFunc(theString); end; end T1; dcltrans transaction TMain var s1 : string; begin ApiFuncWrapper(); ApiFuncWrapper("hello"); ApiFuncWrapper(s1); end TMain;
In case of an error during the ApiWrapper() external function call, all reports including the output windows of Silk Performer show the line number of where the wrapper function has been called. If the function attribute <API_FUNCTION> has not been specified, the line number of the external function call would be reported.