The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SDL2::loadso - Dynamically Load a Shared Object

SYNOPSIS

    use SDL2 qw[:loadso];

DESCRIPTION

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. :)

Functions

These functions may be imported by name or with the :loadso tag.

SDL_LoadObject( ... )

Dynamically load a shared object.

Expected parameters include:

sofile - a system-dependent name of the object file

Returns an opaque pointer to the object handle or undef if there was an error; call SDL_GetError( ) for more information.

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( ... ).

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.

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.

If the requested function doesn't exist, undef is returned.

Expected parameters include:

handle - a valid shared object handle returned by SDL_LoadObject( ... )
name - the name of the function to look up
arguments - optional FFI::Platypus-friendly argument list
retval - optional FFI::Platypus-friendly return value

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.

SDL_UnloadObject( ... )

Unload a shared object from memory.

Expected parameters include:

handle - a valid shared object handle returned by SDL_LoadObject( ... )

LICENSE

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.

AUTHOR

Sanko Robinson <sanko@cpan.org>