spielwiese
Last change
on this file since 05051f was
762407,
checked in by Oleksandr Motsak <motsak@…>, 12 years ago
|
config.h is for sources files only
FIX: config.h should only be used by source (not from inside kernel/mod2.h!)
NOTE: each source file should better include mod2.h right after config.h,
while headers should better not include mod2.h.
|
-
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 "config.h" |
---|
16 | #include <kernel/mod2.h> |
---|
17 | #include <kernel/febase.h> |
---|
18 | #include "static.h" |
---|
19 | |
---|
20 | /* whether pyobject module is linked statically or dynamically */ |
---|
21 | #ifdef HAVE_PYTHON |
---|
22 | |
---|
23 | #if defined(HAVE_STATIC) |
---|
24 | #ifdef HAVE_STATIC_PYTHON |
---|
25 | #define HAVE_STATIC_PYOBJECT |
---|
26 | #endif |
---|
27 | #else |
---|
28 | #ifdef EMBED_PYTHON |
---|
29 | #define HAVE_STATIC_PYOBJECT |
---|
30 | #else |
---|
31 | #define HAVE_DYNAMIC_PYOBJECT |
---|
32 | #endif |
---|
33 | #endif |
---|
34 | #endif |
---|
35 | |
---|
36 | # ifdef HAVE_STATIC_PYOBJECT // Case: link pyobject interface statically |
---|
37 | #include "pyobject.cc" |
---|
38 | void pyobject_setup() { pyobject_init(); } |
---|
39 | |
---|
40 | |
---|
41 | # elif defined(HAVE_DYNAMIC_PYOBJECT) // Case: pyobject is dynamic module (prefered variant) |
---|
42 | |
---|
43 | // forward declaration for Singular/iplib.cc |
---|
44 | void* binary_module_function(const char* lib, const char* func); |
---|
45 | void pyobject_setup() |
---|
46 | { |
---|
47 | void* fktn = binary_module_function("pyobject", "mod_init"); |
---|
48 | if (fktn) (* reinterpret_cast<void (*)()>(fktn) )(); |
---|
49 | else Werror("python related functions are not available"); |
---|
50 | } |
---|
51 | |
---|
52 | #else // Case: no python |
---|
53 | void pyobject_setup() { } |
---|
54 | |
---|
55 | #endif // HAVE_PYTHON |
---|
56 | |
---|
Note: See
TracBrowser
for help on using the repository browser.