0

I managed to process module pymqe.c into pymqe.pyd for Python2 using VC 2017 compiler and my own make file. Unfortunately, it doesn’t work for Python3. If I try compile module pymqe.c from pymqi-1.9.3.tar.gz in the same way, the linking step fails with the error message:

LINK : error LNK2001: unresolved external symbol initpymq

pymqe.lib : fatal error LNK1120: 1 unresolved externals

My make file contains the following instruction to link pymqe.c with the resulting library pymqe.pyd:

/EXPORT:initpymqe pymqe.obj

I assume, the function initpymqe is excluded during compilation for Python3 due to pre-compiler instruction in the source code of the module pymqe.c:

#if PY_MAJOR_VERSION==2

       void initpymqe(void) {
       …
#else

Does anyone know, how to handle this problem?

JoshMc
  • 10,239
  • 2
  • 19
  • 38
lvs64
  • 13
  • 7
  • Try [`pymqi`](https://github.com/dsuch/pymqi), the latest is 1.9.3, Python3 support was added at 1.8.0. `py3mqi` was someone's fork prior to the main pymqi supporting Python3, it is also quite old. – JoshMc Feb 10 '20 at 09:46
  • I’ve already tried module pymqe.c from pymqi-1.9.3.tar.gz with the same result. I noticed, that function initpymqe is declared there within a pre-compliler condition, which presumably excludes the function for Python3. #if PY_MAJOR_VERSION==2 void initpymqe(void) { PyObject *m, *d; /* Create the module and add the functions */ m = Py_InitModule4("pymqe", pymqe_methods, pymqe_module_documentation, (PyObject*)NULL,PYTHON_API_VERSION); #else – lvs64 Feb 10 '20 at 13:04
  • Is there a reason you want to troubleshoot the older fork vs using pymqi 1.9.3? – JoshMc Feb 10 '20 at 13:08
  • But, pymqi-1.9.3 is the latest version available for download and version you have recommended. That's why, I try it. Or, I missundersood you? – lvs64 Feb 10 '20 at 14:14
  • I think you should use pymqi 1.9.3 but your question is all about py3mqi 1.6.0. If you would like to troubleshoot pymqi 1.9.3, please **edit** your question and replace with a similar level of detail about pymqi 1.9.3. Posting errors should not be done in comments because they can't be formatted. – JoshMc Feb 10 '20 at 14:37
  • Where does that make file come from? Did you try running setup.py to have it invoke the compiler? – JoshMc Feb 11 '20 at 00:28
  • The make file was written by one colleague of mine, who has already gone. After he tried running setup.py for Python2 and found out that this way didn’t work, because Python module distutils was incompatible with Visual Studio 2017. – lvs64 Feb 11 '20 at 08:47
  • Have you tried with pymqi 1.9.3? – JoshMc Feb 11 '20 at 08:54
  • I’d like to try. But, for security reasons, there is no access to internet from the server, where the compilation should run. I’m in doubt about that a setup via pip would be able to run. – lvs64 Feb 11 '20 at 10:47
  • `setup.py` is included in pymqi 1.9.3, if you have permission to get the files from pymqi, why would you not be able to run the setup, it does not need to access the internet. – JoshMc Feb 13 '20 at 02:37
  • I've recently managed to get it done. – lvs64 Feb 18 '20 at 11:03

0 Answers0