Changeset 35a0c12 in git for Singular/pyobject_setup.cc


Ignore:
Timestamp:
Dec 6, 2012, 2:46:43 PM (11 years ago)
Author:
Alexander Dreyer <adreyer@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
51f56350e07c1644b3a676e1ad934986088a0bd0
Parents:
8a8315c064275dd1bdd822cbc4e00072d5a3761e
git-author:
Alexander Dreyer <adreyer@gmx.de>2012-12-06 14:46:43+01:00
git-committer:
Alexander Dreyer <adreyer@gmx.de>2012-12-06 15:20:24+01:00
Message:
pyobject.so now autoloaded when needed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/pyobject_setup.cc

    r8a8315c r35a0c12  
    1616#include <kernel/mod2.h>
    1717#include <kernel/febase.h>
     18#include <Singular/blackbox.h>
     19#include <Singular/ipshell.h>
    1820
    1921/* whether pyobject module is linked statically or dynamically */
     
    4042# elif defined(HAVE_DYNAMIC_PYOBJECT) // Case: pyobject is dynamic module (prefered variant)
    4143
    42 // forward declaration for Singular/iplib.cc
    43 void* binary_module_function(const char* lib, const char* func);
    44 void pyobject_setup()
     44
     45/// blackbox support - initialization via autoloading
     46void* pyobject_autoload(blackbox* bbx)
    4547{
    46   void* fktn = binary_module_function("pyobject", "mod_init");
    47   if (fktn) (* reinterpret_cast<void (*)()>(fktn) )();
    48   else Werror("python related functions are not available");
     48  BOOLEAN jjLOADLIB(const char* libname, BOOLEAN autoexport);
     49  if (jjLOADLIB("pyobject.so", TRUE)) return NULL;
     50
     51  return bbx->blackbox_Init(bbx);
    4952}
    5053
     54void pyobject_default_destroy(blackbox  *b, void *d)
     55{
     56  Werror("Python-based functionality not available!");
     57}
     58
     59// Setting up an empty blackbox type, which can be filled with pyobject
     60void pyobject_setup()
     61{
     62  blackbox *bbx = (blackbox*)omAlloc0(sizeof(blackbox));
     63  bbx->blackbox_Init = pyobject_autoload;
     64  bbx->blackbox_destroy = pyobject_default_destroy;
     65  setBlackboxStuff(bbx, "pyobject");
     66}
     67 
    5168#else                // Case: no python
    5269void pyobject_setup() { }
Note: See TracChangeset for help on using the changeset viewer.