How to pass array address to Clarion?

Prototype:

myFunction( ULONG , *ULONG ),PASCAL 

Variables

 myArray ULONG, DIM(30) myStuff ULONG 

Code:

 ... myFunction(myStuff, myArray) ... 

Error:

There is no suitable prototype - C: ...

Is something wrong with the prototype itself or am I passing the variable incorrectly?

For more information, the relevant function is glSelectBuffer (GLsizei, * GLuint), PASCAL

Where GLSizei is equated to ULONG and GLuint is equated to ULONG.

Is equalization likely to break the system? I would not think so, because so far there have been no other problems that have adapted other functions for compatibility with Clarion, but this, in particular, has been extremely difficult. The function searches for an array of user-defined size to use as a buffer to store the selection data. I thought it would be simple enough to create a buffer (see: myArray ULONG, DIM (30)), and then just pass the variable as it should pass the address of the array, but so far this has only led to the compilation error mentioned above .

Any help would be greatly appreciated.

+4
source share
3 answers

Equals:

 GLsizei EQUATE(ULONG) GLuint EQUATE(ULONG) 

Prototype:

 glSelectBuffer( GLsizei , *GLuint ),PASCAL 

Data:

 mySelectionBuffer &STRING myBufferPointer &ULONG curSelection ULONG 

Init:

 mySelectionBuffer &= NEW(STRING(30)) myBufferPointer &= ADDRESS(mySelectionBuffer) 

Using:

 ![glSelectBuffer(Size of Buffer Array, Pointer to Buffer) glSelectBuffer(30, myBufferPointer) 

Then to capture data:

 ... LOOP i# = 1 TO numHits ![result of glRenderMode(GL_RENDER)] curSelection = ADDRESS(mySelectionBuffer) + (SIZE(curSelection) * i#) . ![Process selection data as needed] ... 

Shutdown:

 DISPOSE(mySelectionBuffer) 

Some probably argue that this is not the best way to deal with this problem. However, in the end it was the only solution I came across that not only compiles, but will not subsequently crash on the OpenGL side after passing the data back to it. I would prefer not to play with memory in order to complete my task at hand, but it seems that when working with functions in another API, this is simply inevitable ...

+2
source

The correct approach is to put [] in the prototype. For example, the following program compiles.

  PROGRAM myArray ULONG, DIM(30) myStuff ULONG MAP myFunction( ULONG , *ULONG[] ),PASCAL END CODE myFunction(myStuff,myArray) myFunction Procedure(a,b) code 
+3
source

When all else fails, you can prototype the parameter as LONG and pass the ADDRESS variable to it, something like:

Prototype:

 myFunction( ULONG , LONG ),PASCAL 

Code:

 ... myFunction(myStuff, ADDRESS(myArray)) ... 
+1
source

Source: https://habr.com/ru/post/1345948/


All Articles