0

I have a library (PythonXX.dll) that I need to conditionally load at run-time. To support it, there are extensive include files and over a thousand calls to it.

The good news is that I probably only use about 20-30 of them, but it is still a pain to set up all those GetProcAddress() calls. I also want/need to use the routines with their native names (e.g., PyNumber_Long, not MyPyNumber_Long).

Is there a better or more preferred way to do this?

Jiminion
  • 5,080
  • 1
  • 31
  • 54
  • 1
    Most every programming problem can be solved with an extra level of indirection. Consider to conditionally load *another* DLL that you write that links to this one directly. – Hans Passant Jul 12 '18 at 17:59
  • Is *pythonXX.lib* linked in your app? Then *pythonXX.dll* is automatically loaded when your program starts, so no "*conditionally load at run-time*". Also you can use names like `PyNumber_Long` (even with `GetProcAddress`). Personally I totally disagree with any names that contain "*my*". You could also use delayed loading. I have a small example if you're interested. But I'd really need more context on the problem. – CristiFati Jul 27 '18 at 12:05

0 Answers0