source: git/Singular/pyobject_setup.cc @ 0c2f6d

spielwiese
Last change on this file since 0c2f6d was 76b37c, checked in by Alexander Dreyer <alexander.dreyer@…>, 13 years ago
Merge commit 'origin/master' into pyobject From: Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de> git-svn-id: file:///usr/local/Singular/svn/trunk@13837 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.4 KB
Line 
1// -*- c++ -*-
2//*****************************************************************************
3/** @file pyobject_setup.cc
4 *
5 * @author Alexander Dreyer
6 * @date 2010-12-15
7 *
8 * This header file defines the @c blackbox setup operations for the pyobject
9 *
10 * @par Copyright:
11 *   (c) 2010 by The Singular Team, see LICENSE file
12**/
13//*****************************************************************************
14
15#include <Singular/mod2.h>
16#include <kernel/febase.h>
17#include "static.h"
18
19/* whether pyobject module is linked statically or dynamically */
20#ifdef HAVE_PYTHON
21
22  #if defined(HAVE_STATIC)
23    #ifdef HAVE_STATIC_PYTHON
24      #define HAVE_STATIC_PYOBJECT
25    #endif
26  #else
27    #ifdef EMBED_PYTHON
28      #define HAVE_STATIC_PYOBJECT
29    #else
30      #define HAVE_DYNAMIC_PYOBJECT
31    #endif
32  #endif
33#endif
34
35# ifdef HAVE_STATIC_PYOBJECT // Case: link pyobject interface statically
36#include "pyobject.cc"
37void pyobject_setup() { pyobject_init(); }
38
39
40# elif defined(HAVE_DYNAMIC_PYOBJECT) // Case: pyobject is dynamic module (prefered variant)
41
42// forward declaration for Singular/iplib.cc
43void* binary_module_function(const char* lib, const char* func); 
44void pyobject_setup()
45{
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");
49}
50
51#else                // Case: no python
52void pyobject_setup() { }
53
54#endif  // HAVE_PYTHON
55
Note: See TracBrowser for help on using the repository browser.