SDL2::loadso - Dynamically Load a Shared Object
use SDL2 qw[:loadso];
System dependent library loading routines.
Some things to keep in mind:
These functions only work on C function names. Other languages may have name mangling and intrinsic language support that varies from compiler to compiler.
Make sure you declare your function pointers with the same calling convention as the actual library function. Your code will crash mysteriously if you do not do this.
Avoid namespace collisions. If you load a symbol from the library, it is not defined whether or not it goes into the global symbol namespace for the application. If it does and it conflicts with symbols in your code or other shared libraries, you will not get the results you expect. :)
These functions may be imported by name or with the :loadso tag.
:loadso
SDL_LoadObject( ... )
Dynamically load a shared object.
Expected parameters include:
sofile
Returns an opaque pointer to the object handle or undef if there was an error; call SDL_GetError( ) for more information.
undef
SDL_GetError( )
SDL_LoadFunction( ... )
Look up the address of the named function in a shared object.
This function pointer is no longer valid after calling SDL_UnloadObject( ... ).
SDL_UnloadObject( ... )
This function can only look up C function names. Other languages may have name mangling and intrinsic language support that varies from compiler to compiler.
If the requested function doesn't exist, undef is returned.
handle
name
arguments
retval
Returns a pointer to the function or undef if there was an error; call SDL_GetError( ) for more information.
Note: We break from the upstream API by automatically wrapping the function pointer if provided with an argument list.
Unload a shared object from memory.
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
Sanko Robinson <sanko@cpan.org>
To install SDL2::FFI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SDL2::FFI
CPAN shell
perl -MCPAN -e shell install SDL2::FFI
For more information on module installation, please visit the detailed CPAN module installation guide.