- 
 
- 
  Notifications
 You must be signed in to change notification settings 
- Fork 325
Using precompiled packages #475
-
Am I correct in assuming that precompiled packages can't be used when generating pyd-files? I've tried, and the script importing from my pyd-file fails.
Beta Was this translation helpful? Give feedback.
All reactions
Firstly, you should not be using LoadDLL in your extension modules but LoadDllInExtensionModule. See https://github.com/pyscripter/python4delphi/blob/master/Modules/DemoModule/uMain.pas as a guide.
Regarding runtime packages, is the directory containing them in the path?
Even if it is there was a change in python when searching for dlls. The Windows path is no longer searched.
See
https://docs.python.org/3/library/os.html#os.add_dll_directory 
and https://stackoverflow.com/questions/67805339/is-the-function-os-add-dll-directory-adding-directories-permanently.
You can try:
- copying all runtime packages in the same directory as the pyd file.
- or use the os.add_dll_directory function before im...
Replies: 1 comment 4 replies
-
Not sure what you are trying to do. Could you give a detailed minimal example?
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes, I'd be happy to. Do you have a shared drive that I can upload a sample to?
Beta Was this translation helpful? Give feedback.
All reactions
-
You can upload files here. A zipped project would do.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks for taking time to answer my question. It's much appreciated :)
The attached zip-file contains to project. The only difference between them, apart from their names, is that the project 'DelphiFromPython_DCP.dproj' has 'Link with runtime packages' set to true:
image 
Python 3.12.3 was used:
Beta Was this translation helpful? Give feedback.
All reactions
-
Firstly, you should not be using LoadDLL in your extension modules but LoadDllInExtensionModule. See https://github.com/pyscripter/python4delphi/blob/master/Modules/DemoModule/uMain.pas as a guide.
Regarding runtime packages, is the directory containing them in the path?
Even if it is there was a change in python when searching for dlls. The Windows path is no longer searched.
See
https://docs.python.org/3/library/os.html#os.add_dll_directory 
and https://stackoverflow.com/questions/67805339/is-the-function-os-add-dll-directory-adding-directories-permanently.
You can try:
- copying all runtime packages in the same directory as the pyd file.
- or use the os.add_dll_directory function before importing the pyd extension module.
Beta Was this translation helpful? Give feedback.