Next: , Previous: , Up: Methods   [Index]


Cautions

Cautions when Using Arguments with C Library Calls

The interface for C functions is in development. You can use a C function in a simple expression with any argument, as in the following example.

op1 = __ctalkGetInstanceVariableByName ("self", "value", TRUE);

However, if you want to use a C function in a complex expression, then you must take care that the arguments to the function are C values that correspond to a Ctalk class, unless the function has a template written for it in the class library that performs the translations of specific classes and data types. See Templates.

If you use a function in a method, and the compiler generates an, “implicit declaration,” warning, you can include the library function’s prototype in either the source file or in classes/ctalklib.

Cautions when using Array class elements in C expressions.

If you want to use an Array element in a C expression, you need to take care that the value of the element translates to a void *, which is the C type that Ctalk returns the values of these elements as.

That means elements of class LongInteger might be truncated, and Float class array elements cannot be translated in this manner.

If array elements of these classes occur in C expressions, Ctalk prints a warning at run time.

In these cases, it is necessary to convert the values to a compatible pointer type, for example an object of class String.