Calling API Message Functions

The C language LayGO API message functions, such as lgo_ErrorMessage() return pointers to NUL-terminated arrays of one byte characters. These can be used directly in Delphi as PChars:

result: LResult;

result := lgo_OpenProtocol(lgo_PROTOCOL_X21_BIS, line, 0);

if result < 0 then
    PostError(Format('Failure opening Line %d: %s',
        [line, lgo_ErrorMessage(result)]));