[futurebasic] Solution--> [FB] silly c-code array

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: "support@..." <support@...>
Date: Thu, 3 Jun 1999 12:18:21 -0500
Hello FB people,

s>   I seem to have narrowed down my search for the Type 1 error to the
s>   array I'm using in my for-loop:

I have solved my problem, and thought I would pass on the information
regarding the solution in case any of you run into the same problem, or
face building a code resource in the future that may require
parameters such as an array passed to it.

I found that the type of info I was sending to my code resource was
irrelevant to the Type 1 Error. The problem was with the global array
I was trying to use to store the information being passed to the code
resource. I tried using individual variables declared globally to
store the info with the same results. It seems that any variables
declared outside of a C function will cause this error once the final
project is built in FB.

My solution was to pass along another pointer to each function that
required information from the array passed to the code resource. Here
is an example:

pascal void main(long *ArrayPointer) // this is address, no brackets
{
   anotherfunction(&ArrayPointer[0]) //brackets required here
}

void anotherfunction(long *ArrayPointerTwo) // same as main
{
   var = ArrayPointerTwo[ElementNumber]
}

This code can be called from FB like this:

Call <resType>, <resID>, (@array(0))


Happy coding,
Robert Price
Programmer/Technical Support
support@...