0

I am trying to make a 32bit C# dll interface with Python through Python.NET. However, I want to use certain python libraries that are only available in 64bit version, forcing me to use 64bit python.

Is it possible to interface with a 32bit C# dll through Python.NET from a 64bit Python installation?

Kind regards

Liam
  • 27,717
  • 28
  • 128
  • 190
user44136
  • 25
  • 4
  • 1
    BTW there is no such thing as a C# dll, the compiled DLL is .Net. It could of been written in C#, Vb.Net or even F#. The underlying language doesn't mater as it gets compiled into IL – Liam Jan 29 '19 at 09:15
  • 3
    No; you would have to load it in a 32-bit wrapper executable and use some RPC support (such as WCF) to call its methods from the 64 bit executable. Why is the "C#" dll 32 bit rather than AnyCPU? Is it calling unmanaged 32 bit DLLs? – Matthew Watson Jan 29 '19 at 09:16
  • Thanks for the answers. I inherited the dll from an old project, with the source not available. Recompiling it is thus not an option. – user44136 Jan 29 '19 at 09:22
  • 1
    Youj *may* be able to change the assembly to 64 bit by using [the CorFlags Conversion Tool](https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-2.0/ms164699(v=vs.80)) - But this is fraught with peril. If the assembly targets any unmanaged code it's likely to explode at runtime. – Matthew Watson Jan 29 '19 at 09:30

0 Answers0