@@ -295,24 +295,10 @@ int write_python_table_native(std::ostream &out) {
295
295
296
296
out.put (' \n ' );
297
297
298
- out << " #if PY_MAJOR_VERSION >= 3 || !defined(NDEBUG)\n "
299
- << " #ifdef _WIN32\n "
300
- << " extern \" C\" __declspec(dllexport) PyObject *PyInit_" << library_name << " ();\n "
301
- << " #elif __GNUC__ >= 4\n "
302
- << " extern \" C\" __attribute__((visibility(\" default\" ))) PyObject *PyInit_" << library_name << " ();\n "
303
- << " #else\n "
304
- << " extern \" C\" PyObject *PyInit_" << library_name << " ();\n "
305
- << " #endif\n "
306
- << " #endif\n " ;
307
-
308
- out << " #if PY_MAJOR_VERSION < 3 || !defined(NDEBUG)\n "
309
- << " #ifdef _WIN32\n "
310
- << " extern \" C\" __declspec(dllexport) void init" << library_name << " ();\n "
311
- << " #elif __GNUC__ >= 4\n "
312
- << " extern \" C\" __attribute__((visibility(\" default\" ))) void init" << library_name << " ();\n "
298
+ out << " #if PY_MAJOR_VERSION >= 3\n "
299
+ << " extern \" C\" EXPORT_CLASS PyObject *PyInit_" << library_name << " ();\n "
313
300
<< " #else\n "
314
- << " extern \" C\" void init" << library_name << " ();\n "
315
- << " #endif\n "
301
+ << " extern \" C\" EXPORT_CLASS void init" << library_name << " ();\n "
316
302
<< " #endif\n " ;
317
303
318
304
out << " \n "
@@ -361,14 +347,6 @@ int write_python_table_native(std::ostream &out) {
361
347
<< " }\n "
362
348
<< " \n "
363
349
364
- << " #ifndef NDEBUG\n "
365
- << " void init" << library_name << " () {\n "
366
- << " PyErr_SetString(PyExc_ImportError, \" " << module_name << " was "
367
- << " compiled for Python \" PY_VERSION \" , which is incompatible "
368
- << " with Python 2\" );\n "
369
- << " }\n "
370
- << " #endif\n "
371
-
372
350
<< " #else // Python 2 case\n "
373
351
<< " \n "
374
352
<< " void init" << library_name << " () {\n " ;
@@ -402,15 +380,6 @@ int write_python_table_native(std::ostream &out) {
402
380
403
381
out << " }\n "
404
382
<< " }\n "
405
- << " \n "
406
- << " #ifndef NDEBUG\n "
407
- << " PyObject *PyInit_" << library_name << " () {\n "
408
- << " PyErr_SetString(PyExc_ImportError, \" " << module_name << " was "
409
- << " compiled for Python \" PY_VERSION \" , which is incompatible "
410
- << " with Python 3\" );\n "
411
- << " return nullptr;\n "
412
- << " }\n "
413
- << " #endif\n "
414
383
<< " #endif\n "
415
384
<< " \n " ;
416
385
0 commit comments