[Gambas-user] Gambas3 Pointers example - signal #6

Demosthenes Koptsis demosthenesk at ...626...
Wed Jan 19 08:27:39 CET 2011


On Tue, 2011-01-18 at 22:08 -0800, John Spikowski wrote:
> I was thinking that you were freeing pFunc (using it's VARPTR) rather
> than freeing the memory associated to the pointer being returned. I have
> to agree with Benoît that working with external memory (variables) and
> structures are a 'at your own risk' task in Gambas. (rules vary by what
> your trying to access)
> 

Hmm.. ok i see maybe the name of external function made a confusion.

Extern free_ptr(ptr As Pointer) In "libc:6" Exec "free"

the name of C function is free() but this name is also a Gambas3 word.

so i declare the external function with different name.

i choose as name free_ptr(ptr As Pointer), a better name would be
free_pointer(pointer As Pointer) or free_a_c_pointer(pointer As
Pointer)  

Here there is no relevance with VarPtr.

Ptr is just an abbreviation for Pointer word which we can use in code.


-- 
Regards,
Demosthenes Koptsis.





More information about the User mailing list