Clarion data type equivalents

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 typeClarion 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 charBYTE, 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 char **errmsg and the Clarion parameter is a Long.

You need to declare two variables, a CString reference and a Long:

CStringRef &CString
CStringRefAddress 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:

CStringRef &= (CStringRefAddress)

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.

You dereference the pointer to to the first element and that is a pointer to the first string.

You add 4 (in 32 bit code, 8 in 64 bit code which doesn't yet exist in the Clarion world) to the original pointer and you are now pointing to the second pointer.

Add 4 again, the third pointer, and so on.

When the derefenced pointer is zero, you've reached the end of the array.

structGROUP (need RAW)
unsigned shortUSHORT
signed short, shortSHORT

int, signed int,

long, signed long,

signed

SIGNED or LONG - UNSIGNED is Equate(Long)

unsigned, unsigned long, unsigned int

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.
floatSREAL
doubleREAL
voidUsually appears as a return type, indicating that nothing is returned.
void *This is a pointer to something. Use a LONG or UNSIGNED.