4

Prototype:

myFunction( ULONG , *ULONG ),PASCAL

Variables:

myArray ULONG, DIM(30)
myStuff ULONG

Code:

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

Error:

No matching prototype available - C:...

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

For more specifics, the actual function in question is glSelectBuffer( GLsizei , *GLuint ),PASCAL

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

Is it possible the equates are causing a breakdown in the system? I wouldn't think so because thus far there have been no other issues adapting other functions to be compatible with Clarion but this one in particular has been exceedingly troublesome. The function is looking for an array of user defined size to use as a buffer to hold selection data. I thought it would be simple enough to create a buffer (see: myArray ULONG, DIM(30) ) and then just pass the variable since it should pass the address of the array but so far this has only resulted in the compile error listed above.

Any help would be greatly appreciated.

Carlos Gutiérrez
  • 13,972
  • 5
  • 37
  • 47
Proxus
  • 61
  • 5

3 Answers3

3

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

  PROGRAM


myArray ULONG, DIM(30)
myStuff ULONG

  MAP  
   myFunction( ULONG , *ULONG[] ),PASCAL

  END

  CODE
    myFunction(myStuff,myArray)

myFunction  Procedure(a,b)
  code
Bruce
  • 911
  • 2
  • 7
  • 12
2

Equates:

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)

Use:

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

Then to capture the 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 will probably argue that this was not the best way of handling the issue, However at the end of the day it was the only solution I came across that would not only compile but also not subsequently crash on the OpenGL side after passing the data back to it. I would have preferred to avoid playing with memory to accomplish my task at hand but it seems that when dealing with functions in other API's it is simply unavoidable...

Proxus
  • 61
  • 5
1

When everything fails, you can prototype a parameter as LONG and pass in it the ADDRESS of the variable, something like:

Prototype:

myFunction( ULONG , LONG ),PASCAL

Code:

...
myFunction(myStuff, ADDRESS(myArray))
...
Carlos Gutiérrez
  • 13,972
  • 5
  • 37
  • 47
  • I did try this at one point, Unfortunately when using this method the OpenGL call would crash out even though I was able to successfully compile. I did however find a solution, I will be posting it up here shortly. – Proxus Apr 01 '11 at 14:58