in reply to Managing C library memory in XS
At first pass, I would probably go with the idea of copying the data to/from Perl variables as needed.
However, I admit I like the idea of just being able to pass a blessed pointer to Perl. So, how about a middle ground? For the free-able objects, go ahead and pass the bless pointer. For the none-free-able, allocate a struct, memcpy the data, then pass the new pointer as a blessed pointer. Since you allocated the memory, it is free-able.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Managing C library memory in XS
by petermogensen (Sexton) on May 05, 2014 at 17:27 UTC | |
by RonW (Parson) on May 05, 2014 at 21:42 UTC | |
by petermogensen (Sexton) on May 06, 2014 at 05:59 UTC | |
by RonW (Parson) on May 06, 2014 at 16:32 UTC | |
by petermogensen (Sexton) on May 06, 2014 at 19:21 UTC | |
by locked_user sundialsvc4 (Abbot) on May 05, 2014 at 18:22 UTC | |
by petermogensen (Sexton) on May 05, 2014 at 18:55 UTC |