Python Forum

Full Version: Using C++/CLI wrapper functions by Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have created C++ Dll to be loaded by many programs, interfaces (also Python). This Dll is calling another C++/CLI Dll wrapper which wraps C# Dll (Licencing functions).

This program can work in several interfaces fine (C++ .exe, C# GUI...), but when calling by Python it fails always on the C++/CLI Dll wrapper function. In this, it is also unable to go inside the C++/CLI Dll function (probably unable to load the Dll). When I call it from Python console, I receive

Traceback (most recent call last): File "", line 1, in OSError: [WinError -532462766] Windows Error 0xe0434352

I found out on internet that this is reported by many authors. But I was not able to find any solution.

I really don't understand why is that? As I mentioned, I call Dll also from C++ .exe or C# .exe without any problem. Also if I comment wrapper function, then can use all C++ Dll functions without errror.

Thank you in advance for your answer.
Hello,

I have an issue similar to the one you describe, raising the same error. I developed a DLL in C++ that, for a specific case, call a function of a second (external) DLL. It works fine in C++ but it fails for this specific case when it is called from Python code.
Following this thread, https://stackoverflow.com/questions/4579...reated-dll, I have found that if I put my external DLL where my python.exe is it works fine.

I then tried to specify the path to my external DLL using the function os.add_dll_directory() but it seems to be useless.

Since you asked your question 3 months ago, I was wondering if you found a way to overcome your issue?

Thanks
Hello,

I am really suprised. I found out that this forum is dead.

The problem was as you described. It is assumed that dependencies are nearby .exe (Python). Here is the solution

http://pragmateek.com/if-your-plumbing-d...#more-1745

Hope this help you as me.