Most of the C types are from Carl Barnes' excellent Clarion Magazine article Compiling C with the Clarion IDE, Part 1: It's Easier Than You Think.
C type | Clarion type |
---|---|
* | pass by address - <omittable> |
& | pass by address - required |
[#] | Array, use DIM(#) . The name of an array is actually a pointer to the first element of the array. So arrays tend to be passed by address even though you do not see an asterisk. |
char, unsigned char, signed char | BYTE , but probably a string type |
char *, char[] | CSTRING or STRING (need RAW ). If the array has a dimension number it tends to be a fixed length string e.g. char Digest[16] is a STRING(16) . A char * could be a *BYTE , but it is rare. |
char ** | This is a pointer to a pointer. There's an example of this in John Taylor's ClarionMag article Embedding The SQLite Engine In Clarion Applications. The C parameter is You need to declare two variables, a CString reference and a Long:
You pass in the CStringRefAddress variable to the function call. If it comes back as a non-zero value, you obtain the string this way:
If the pointer is to a string array you use a similar technique. From John Christ: The value returned by the function is a pointer to the 1st (or in C, 0th) element of an array of pointers to strings. |
struct | GROUP (need RAW ) |
unsigned short | USHORT |
signed short, short | SHORT |
|
|
| ULONG - avoid using the ULONG type in Clarion. The object code created for ULONG math uses the decimal library, which is much slower than the code used for a LONG . The UNSIGNED type is equated to a LONG , which is preferable. |
float | SREAL |
double | REAL |
void | nothing to enter |
Void * | This is a pointer to something. Use a LONG or UNSIGNED . |