External Procedure Signature


An external procedure is declared the same way as a signature for any Gilda procedure. Arguments are passed using the same conventions for parameters.

An alias can also be coded in order to call external procedures that may use naming conventions that differ from Gilda. The alias name may be quoted. The procedure can then be called from a Gilda procedure using the signature name and generated code for the call will use the alias.

For example to pass Gilda's dynamic strings to a C procedure the string will need to be converted to a null terminated string. Not only that, but null characters are permitted in a Gilda string so that has to be accounted for. The C.String class in the Basis library contains procedures that perform these conversions. Gilda strings should never be passed as is between a Gilda procedure and an external procedure.

Passing structures with a foreign language also requires some attention. The internal layout of structure types can vary between Gilda compilers. Instead Record types have a well defined binary layout. Their intended use is for external data sharing.

Numeric types are passed using the same format as a native C compiler. The same goes for pointers. Arrays are always passed by reference using row-major order.

C/C++ Procedure Member

Map File