Error when Compiling Cython into 32bit app

0

I have python code that I am using Cython to convert to C (in order to call from C# 32bit application).

  1. When I use MSVC x86 Native Tool Command prompt to run:

python setup.py build_ext --inplace --compiler=msvc I get the error:

python38.lib(python38.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86' error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x86\link.exe' failed with exit status 1112

  1. When I use MSVC X64 Native Tool command prompt, I try to first run: setenv /x86 but setenv is not recognized. However, I can build as x64 successfully. When I compile the resulting c code as dll to call from C#, it is not a surprise that I get the following memory access violation:

    System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I was wondering how to solve this issue, and be able to build for x86.

Thanks very much in advance!

python
c#
c
cython
asked on Stack Overflow Oct 1, 2020 by OpusPyhton

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0