Pointer question

BlitzMax Forums/BlitzMax Programming/Pointer question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This is a question about calling dlls with variable pointers.

I have a function that accepts a variable and changes it, like this:

local texture
glGenTextures(1,VarPtr texture)

And the function sets "texture" to the right value.


Now I have a function where the variable type is a byte ptr. The function is generating an array of vertices:

local buffer:Byte ptr
Function GenVertices(varptr buffer)

The function does not fill in the buffer, it sets the value of the buffer variable to a memory buffer the function allocates.

Then I want to create a static bank from buffer. This has me confused. If I pass the varptr to buffer it crashes. If I pass buffer it crashes. How should I pass this variable?