in reply to Re^2: Wrapping C constructor with opaque pointer using Platypus
in thread Wrapping C constructor with opaque pointer using Platypus

This allocates memory, either on the stack or in the area for global memory:

igraph_t g;

For Perl, you will need to allocate a buffer, more or less with:

use vars '$g'; $g = "\x00" x IGRAPH_T_SIZE;

... and ideally you can call/compile sizeof(igraph_t) in C so your C compiler and Perl agree on how much memory should be allocated for it.

Replies are listed 'Best First'.
Re^4: Wrapping C constructor with opaque pointer using Platypus
by pokki (Monk) on Feb 14, 2017 at 10:13 UTC

    Alright, I think I get it now (and I very obviously need to step back and find a C book somewhere). Platypus even exposes a sizeof() method so I can try some stuff with that.

    Thanks to all involved!