Re: Testing atoms if pointer
- Posted by RStowasser Aug 16, 2010
- 1280 views
mattlewis said...
This is probably the point at which it's a good idea to ask what you're trying to accomplish, rather than how you're trying to accomplish it. So, why do you want to know if you're dealing with an allocated pointer?
Matt
Currently I am experimenting with the Iup dlls and trying to wrap functions with variable arguments. Basically I am doing this in a similar way like this (a little bit simplified):
Ihandle* IupHbox(Ihandle *child, ...); [in C]
--constant hIupHbox = def_c_func(hIup, "IupHbox", {P}, P) object hIupHbox public function IupHbox(sequence child) -- returns id of created element, or NULL if error hIupHbox = -1 sequence c_args = {} for x = 1 to length(child) do c_args &= P end for hIupHbox = define_c_func(hIup, "IupHbox", c_args, P) Ihandle id_element = c_func(hIupHbox, child) if id_element = NULL then crash("something wrong with IupHbox") end if return id_element end function
This is a relative simple example. But there are some functions in the Iup library in which case I am not sure if I always can use C_POINTER. So I wondered if there would be a simple check to see if an arguement in the sequence is a pointer or a value.
Roland