Next Previous Up Top Contents Index

2.4 Naming and mapping conventions

2.4.6 Handling return of multiple values

In cases where the C library function takes a pointer argument as a place to store a pointer, integer, or boolean value, the corresponding Dylan function uses multiple return values to return such output parameters following the original function return value. For example, where C code does:

BOOL ok;  
DWORD NumberRead;  
ok = ReadConsoleInput(handle, buffer, length, & NumberRead);

in Dylan it would be:

let ( ok :: <boolean>, NumberRead :: <integer> ) =
    ReadConsoleInput(handle, buffer, length);

Similarly, this function returns multiple values instead of a structure:

let ( x, y ) = GetLargestConsoleWindowSize(handle);


C FFI and Win 32 Reference - 31 MAR 2000

Next Previous Up Top Contents Index