1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include "Python.h"
#include "../inc/dynamic.h"
#if defined(__Mac)
# undef dlopen
#endif
PyMODINIT_FUNC ENTRY_POINT(void) {
DL_CONST void *lib;
void (*initer)(void);
if ( (lib = dlopen("libgunicode" SO_EXT,RTLD_LAZY))==NULL ) {
#ifdef PREFIX
lib = dlopen( PREFIX "/lib/" "libgunicode.so.3.0.2", RTLD_LAZY);
#endif
}
if ( lib==NULL ) {
PyErr_Format(PyExc_SystemError,"Missing library: %s", "libgunicode");
return;
}
if ( (lib = dlopen("libgutils" SO_EXT,RTLD_LAZY))==NULL ) {
#ifdef PREFIX
lib = dlopen( PREFIX "/lib/" "libgutils.so.1.0.3", RTLD_LAZY);
#endif
}
if ( lib==NULL ) {
PyErr_Format(PyExc_SystemError,"Missing library: %s", "libgutils");
return;
}
if ( (lib = dlopen("libfontforge" SO_EXT,RTLD_LAZY))==NULL ) {
#ifdef PREFIX
lib = dlopen( PREFIX "/lib/" "libfontforge.so.1.0.0", RTLD_LAZY);
#endif
}
if ( lib==NULL ) {
PyErr_Format(PyExc_SystemError,"Missing library: %s", "libfontforge");
return;
}
initer = dlsym(lib,"ff_init");
if ( initer==NULL ) {
PyErr_Format(PyExc_SystemError,"No initialization function in fontforge library");
return;
}
(*initer)();
}
|