Advanced PowerBuilder

HomePrevious Lesson: Datatypes For External Function Arguments
Next Lesson: Calling an External Function

External Function Arguments

Arguments to external functions can be passed by reference or by value. For string datatype arguments, PowerBuilder always passes a pointer to the string, irrespective of whether the argument is passed by value or by reference. The difference is that if you pass the argument by reference, any change by the function to the string is available back to PowerBuilder.

An external function cannot return PowerBuilder a pointer. PowerBuilder cannot access memory beyond the memory it allocates for it self.

If the function takes a string as an argument by reference and replaces it with some value, the PowerScript string variable must be long enough to hold the returned value.

Before you call the external function, use the Space() function to fill the string with blanks, equal to the maximum number of characters you expect the function to return.
HomePrevious Lesson: Datatypes For External Function Arguments
Next Lesson: Calling an External Function