Imager
view release on metacpan or search on metacpan
#if defined(OS_hpux)
#include <dl.h>
typedef shl_t minthandle_t;
#elif defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef HMODULE minthandle_t;
#undef WIN32_LEAN_AND_MEAN
#else
#include <dlfcn.h>
typedef void *minthandle_t;
#endif
#include "ext.h"
struct DSO_handle_tag {
minthandle_t handle;
char *filename;
func_ptr *function_list;
};
#include "imager.h"
#include "dynaload.h"
/* #include "XSUB.h" so we can compile on threaded perls */
#include "imageri.h"
static im_context_t
do_get_context(void) {
return im_get_context();
}
static symbol_table_t symbol_table=
{
i_has_format,
ICL_set_internal,
ICL_info,
do_get_context,
im_img_empty_ch,
i_img_exorcise,
i_img_info,
i_img_setmask,
i_img_getmask,
i_box,
i_line,
i_arc,
i_copyto,
i_copyto_trans,
i_rubthru
};
/*
Dynamic loading works like this:
dynaload opens the shared object and
loads all the functions into an array of functions
it returns a string from the dynamic function that
can be supplied to the parser for evaling.
*/
void
DSO_call(DSO_handle *handle,int func_index,HV* hv) {
mm_log((1,"DSO_call(handle %p, func_index %d, hv %p)\n",
handle, func_index, hv));
(handle->function_list[func_index].iptr)((void*)hv);
}
func_ptr *
DSO_funclist(DSO_handle *handle) {
return handle->function_list;
}
#if defined( OS_hpux )
void*
DSO_open(char* file,char** evalstring) {
shl_t tt_handle;
void *d_handle,**plugin_symtab,**plugin_utiltab;
int rc,*iptr, (*fptr)(int);
func_ptr *function_list;
DSO_handle *dso_handle;
void (*f)(void *s,void *u); /* these will just have to be void for now */
int i;
*evalstring=NULL;
mm_log( (1,"DSO_open(file '%s' (0x%08X), evalstring 0x%08X)\n",file,file,evalstring) );
if ( (tt_handle = shl_load(file, BIND_DEFERRED,0L)) == NULL) return NULL;
if ( (shl_findsym(&tt_handle, I_EVALSTR,TYPE_UNDEFINED,(void*)evalstring))) return NULL;
/*
if ( (shl_findsym(&tt_handle, "symbol_table",TYPE_UNDEFINED,(void*)&plugin_symtab))) return NULL;
if ( (shl_findsym(&tt_handle, "util_table",TYPE_UNDEFINED,&plugin_utiltab))) return NULL;
(*plugin_symtab)=&symbol_table;
(*plugin_utiltab)=&i_UTIL_table;
*/
if ( (shl_findsym(&tt_handle, I_INSTALL_TABLES ,TYPE_UNDEFINED, &f ))) return NULL;
mm_log( (1,"Calling install_tables\n") );
( run in 0.845 second using v1.01-cache-2.11-cpan-99c4e6809bf )