Distuils MSVC link failure between libraries

Hi there, I'm trying to create multiple C++ extensions that have dependencies between them. This works fine on Linux with gcc, but I get link failures on Windows with MSVC due to this <https://github.com/python/cpython/blob/master/Lib/distutils/_msvccompiler.py...> "*IMPLIB*" is an optional argument, when not specified, the generation of exp/lib files default to the same filename and directory as the dll. If precompiled extensions are to be published with MSVC and expected to be linked against (maybe this is not recommended?) the lib files are required so it seems a bit peculiar to me to not have them with the dll as is the default behavior. Proof of concept <https://github.com/0xz/distutils_msvc/blob/master/setup.py> Thanks Philip

I'm trying to create multiple C++ extensions that have dependencies between them. This works fine on Linux with gcc, but I get link failures on Windows with MSVC due to this <https://github.com/python/cpython/blob/master/Lib/distutils/_msvccompiler.py...> Is that the only issue? MSVC and FCC linking is pretty different-- I know I tried to do something like this (a few years ago) and it didn't work -- I think because the symbols I needed weren't exported, or something like that. If precompiled extensions are to be published with MSVC and expected to be linked against (maybe this is not recommended?) Indeed, it is not recommended-- onhe passive sense -- I.e. the system isn't designed to support that. IIUC, while extension modules are dlls, they are specifically designed to be called from cpython, not as general purpose libraries to be called from other C code. The solution is to build a dill with all the C/C++ code you need, and then have all your modules link against that dll. Proof of concept <https://github.com/0xz/distutils_msvc/blob/master/setup.py> If that works, and doesn't cause other problems, (I am not qualified to assess that), it could be handy. There are times I would have liked distutils to be able to build a dll for me that could be used by other modules. -CHB
participants (2)
-
Chris Barker - NOAA Federal
-
P