Search code examples
c++c++-cliwrapperironpython

Calling C++/CLI DLL from IronPython leading to an "not a valid Win32 application. (Exception from HRESULT: 0x800700C1)" error


I've been trying to implement this tutorial: https://www.red-gate.com/simple-talk/development/dotnet-development/creating-ccli-wrapper/

and even though it works. When I try to call the Wrapper.dll from IronPython I get an error. I cannot even load the DLL.

This is the IronPython code:

import clr

clr.AddReferenceToFileAndPath("Wrapper.dll")
clr.AddReference("mscorlib")

import CLI
import System

if __name__ == "__main__":
    e = CLI.Entity("the guy", 54, -123)
    e.Move(-54, 123)
    System.Console.WriteLine(e.XPosition + " " + e.YPosition)

Could anyone please explain what the issue is and hint me a potential solution?


Solution

  • The answer to my question is: re-build all projects in x64 just because IronPython used is x64 build.