Closed neurolabusc closed 3 years ago
I dont like the idea 'to explicitly load it', it's bad practice. Better to add the info somewhere.
An alternative would be to add the path of the Python3*.dll to the Windows DLL search path using SetDllDirectoryA, that way Windows can find and load the vcruntime DLL if needed:
{$ifdef windows}
function SetDllDirectory(lpPathName: LPCTSTR):LongBool; stdcall; external 'kernel32.dll' name 'SetDllDirectoryA'; //uses add windows,sysutils,
{$endif}
...
SetDllDirectory(PChar(GetDllPath));
It''s not needed for Py4Lazarus, it is the code for final app. so add it in your app.
The Python-for-Lazarus demos_lazarus applications will not run on computers that do not have vcruntime in their system path. The error message provided does not provide the user or developer with any feedback for diagnosis. I would suggest adding it to Python-for-Lazarus, but alternatively you could add it to the demo apps.
I have added the SetDllDirectory solution to the PythonPascalBridge repository. This is an alternative to Python-for-Lazarus but allows static linking of Python into Linux and macOS executables.
But that VS runtime is present, because it’s required for python DLL.
At the moment, Python-for-Lazarus running on Windows fails to load the Python3*.dll if the computer does not have the file vcruntime140.dll in the system's path. I notice that CudaText includes this dll.
I would suggest including this library at the same location as the Python3*.dll and explicitly loading it by changing Line 2911