Manisha Mirajkar <[EMAIL PROTECTED]> writes:
>I need to convert a void *& varibale from a C function to a perl
>variable?And later use this value to call another C function.
>
>eg :
>My C functiona are -  MyCFunc(void *& arg)
>                              -  MyFuncCalled(void *p)

If they have & in then they are not C but C++ - but that is 
not a big deal.

>
>XS File : void MyXSFunc()
>                    void *& arg
>                CODE :
>                    MyCFunc(arg);
>                    MyFuncCalled(arg);
>
>How do I  typemap a void*& ?

Presumably MyCFunc takes a ref because that is an output argument.
The normal way to handle void * in a typemap is to store the pointer 
in an SvIV. e.g. the T_PTR type.
If you really have control over the funcs than making 
that 

void *
MyCFunc(void)

would be cleaner and true C not only C++.


As the C++ & is just a hidden de-ref you should be able to (almost) 
ignore it for the purposes of typemaping - other than using & 
in the XS and marking it as an OUTPUT. 
You may need INIT or NO_INIT depending on whether it is a true
output parameter.

So something like:

void
MyCFunc(arg)
void *  &arg
OUTPUT:
        arg

void
MyFuncCalled(arg)
void *  arg 

Would map the functions directly.


-- 
Nick Ing-Simmons

Reply via email to