Big Willy has asked for the wisdom of the Perl Monks concerning the following question:
The problem, however, is that since I pass by reference $sin would actualyl be holding struct data, to a pointer to it. I tried it with a typemap of T_UV to no avail. It gives me compiling issues about conversion to non-scalar type (a struct) which is a nono. I also tried this:int libnet_select_device(sin, device, ebuf) SockAddrIn & sin = NO_INIT u_char * & device = (u_char *) SvPV_nolen(ST(1)); u_char & ebuf OUTPUT: sin device ebuf
SockAddrIn pointers are of type T_PTROBJ (I tried T_PTRREF too). This gives me another problem. It says that sin is not of type SockAddrInPtr. When I typemap to T_PTRREF, it core dumps. As $sin is actually only there to accept what is passed back into it from the function, I suppose I need to initialize it somehow. How can I do that or do whatever it is that will solve my problem?int libnet_select_device(sin, device, ebuf) SockAddrIn * sin = NO_INIT u_char * & device = (u_char *) SvPV_nolen(ST(1)); u_char & ebuf OUTPUT: sin device ebuf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XS Question: Problem with implementing a C struct representation in Perl
by c-era (Curate) on May 03, 2001 at 16:43 UTC | |
by Big Willy (Scribe) on May 04, 2001 at 00:23 UTC |