Open
Description
by providing a package I still want that constant is created at specified package.
It would be nice if we also specify some global
space for all constants (this is useful for large libraries)
$ffi->load_custom_type('::Enum', 'SDL_RendererFlip',
{ ret => 'int', package => 'SDL2::Render', global => 'SDL2' },
...
And when $ffi
is instantiated we can pass parameter which trigger spoil global
namespace or not:
my $ffi = FFI::Platypus->new( api => 1, global => 1 ); # Enable all globals
my $ffi = FFI::Platypus->new( api => 1, global => [ 'SDL2', 'SomeOtherSpace' ] ); # Enable only these two
my $ffi = FFI::Platypus->new( api => 1, global => 0 ); # Constant still accessable via SDL2::Render::SDL_FLIP_NONE
my $ffi = FFI::Platypus->new( api => 1 ); # Constant still accessable via SDL2::Render::SDL_FLIP_NONE
Also would be nice if it automatically remove some prefix:
$ffi->load_custom_type('::Enum', 'SDL_RendererFlip',
{ ret => 'int', package => 'SDL2::Render', remove => 'SDL_' },
['SDL_FLIP_NONE' => 0x00000000], # /**< Do not flip */
will create SDL2::Render::FLIP_NONE
. This will save us from repeating SDL
because it is already at package name
Metadata
Assignees
Labels
No labels
Activity