[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
        How to pass arrays between FORCE and C functions
        --------------------------------------------------------------------

        Q:    I'm having trouble passing arrays between FORCE and C.  What's
        wrong?

        A:    Before we go any further, be sure that you have read the above
        section, "How FORCE Passes Parameters."

        When you pass an array of any kind to a C function, be SURE that you
        do not prototype your parameters with either CONST or VALUE, because
        C ALWAYS expects the address of an array, not the array itself.

        Here's a quick example of a prototype you might write:

           FUNCTION INT hash PROTOTYPE
                PARAMETERS INT array[10]    && passes the address

        and the corresponding C function would look like:

           int hash( array )
           int array[];      /* or int *array */

        Finally, when you call your C function, pass the array like this:

           hashvalue = hash( key[] )



See Also: General Compatibility Linking Parameter_passing
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson