Creating a DLL from a wrapped cpp file with SWIG

前端 未结 8 1905
刺人心
刺人心 2021-01-02 20:42

I am in the process of learning how to use SWIG on Windows.

The following is my c++ code:

 /* File : example.cxx */

 #include \"example.h\"
 #defin         


        
8条回答
  •  隐瞒了意图╮
    2021-01-02 21:06

    The problem seems to be that, for unknown reasons, the file pyconfig.h FORCES the use of a specifically named .lib file. OUCH! Frankly, this looks like a bug to me - let the programmer specify what .lib file to use! Don't force it!

    In the code below, you could simply #ifdef 0 the entire thing, or rename "python27_d" to "python".

    Anyway, here is the offensive code from pyconfig.h:

    /* For an MSVC DLL, we can nominate the .lib files used by extensions
    */
    #ifdef MS_COREDLL
    #   ifndef Py_BUILD_CORE /* not building the core - must be an ext */
    #       if defined(_MSC_VER)            /* So MSVC users need not specify the .lib file in          their Makefile (other compilers are generally           taken care of by distutils.) */
    #           ifdef _DEBUG
    #               pragma comment(lib,"python27_d.lib")
    #           else
    #               pragma comment(lib,"python27.lib")
    #           endif /* _DEBUG */
    #       endif /* _MSC_VER */
    #   endif /* Py_BUILD_CORE */
    #endif /* MS_COREDLL */
    

提交回复
热议问题