Hi all,
I am trying to wrap PCAN-ISO-TP.dll (ver 3.4) into LabVIEW VIs on the Win10 environment.
There is a language construct called "call library function node" in LabVIEW responsible for loading and interfacing dll.
The "call library function node" fails to load PCAN-ISO-TP.dll (ver 3.4) but succeeds to load PCAN-ISO-TP.dll (ver 2.2).
The PCANBasic.dll, the dependency of PCAN-ISO-TP.dll, is placed in the same folder.
Then, I executes the Python sample code "07_classic_can_read_write" (Python 3.10.11 64bit interpreter) on Visual Studio Code.
The same thing happened.
Ver 3.4 fails to initialization, but initialization of Ver 2.2 is ok.
The PCAN-ISO-TP.dll (ver 3.4) and PCANBasic are put inside System32.
I also tried to put them inside a local folder and invoked them from the local folder, but everything is the same.
Any suggestion on or further experiment for resolving this problem?
Thank you for any help you can provide.
Godel
Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python
Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python
Hello,
we do not work with LabVIEW so we cannot give much help on this, but it seems like you may be mixing the x86 and x64 bit libraries. As you are using Python 64-Bit, then you should assert that you are using the x64 version of the dlls (PCAN-ISO-TP.dll and PCANBasic.dll). You can see this by showing the details of the file properties on the dlls. In the decription of the file you will see if it is the x86 or x64 version.
we do not work with LabVIEW so we cannot give much help on this, but it seems like you may be mixing the x86 and x64 bit libraries. As you are using Python 64-Bit, then you should assert that you are using the x64 version of the dlls (PCAN-ISO-TP.dll and PCANBasic.dll). You can see this by showing the details of the file properties on the dlls. In the decription of the file you will see if it is the x86 or x64 version.
Best regards,
Keneth
Keneth
Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python
Hi Wagner,
I am quite sure that the two x64 version dlls (PCAN-ISO-TP.dll (ver3.4) and PCAN-Basic.dll (ver4.3)) are put inside System32.
And Python fails to initialization.
Godel
I am quite sure that the two x64 version dlls (PCAN-ISO-TP.dll (ver3.4) and PCAN-Basic.dll (ver4.3)) are put inside System32.
And Python fails to initialization.
Godel
Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python
Hello,
please note that the current version of PCAN-ISO-TP offers support for Python v2.7 and v3.8. Please try with a version of Python equals or older than v3.8.
please note that the current version of PCAN-ISO-TP offers support for Python v2.7 and v3.8. Please try with a version of Python equals or older than v3.8.
Last edited by K.Wagner on Tue 2. May 2023, 11:52, edited 1 time in total.
Reason: Extract of the Python header file of PCAN-ISO-TP
Reason: Extract of the Python header file of PCAN-ISO-TP
Best regards,
Keneth
Keneth
Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python
Hi,
Testing on Python 3.8.10 64bit, and result is the same. (Antivirus is turned off.)
Testing on Python 3.8.10 64bit, and result is the same. (Antivirus is turned off.)
Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python
Hello again,
we have tested the PCAN-ISO-TP example "07_classic_can_read_write" on a clean Windows 11 PC, using the latest PCAN-ISO-TP and having installed the latest device drivers and PCAN-Basic API (using the PEAK-Drivers Setup) and also installed the latest Python version, v3.11.3, and with some adjusment we were able to successfully run the sample.
First of all, it seems there is a change in the way how external library paths are resolved, beginning with Python v3.8, as described in the article "DLL not found after switching from Python 3.7.6 to Python 3.10.3" from stackoverflow. Moreover, a new function was included to handle with library paths, os.add_dll_directory. The help of it states:
.
The sample ran by removing the PCAN-ISO-TP.dll from the project folder and copying it into the WIndows\System32 folder. Note that the PEAK-Drivers Setup also copies the needed PCAN-Basic.dll into this folder. Having these two libraries in this folder the sample application works as expected.
You mentioned alraedy, that you are copying the files in the WIndows\System32 folder, so this workaround may not work for you, and you may be experimenting a different or additional problem we are not aware of. Unfortunatelly, we cannot reproduce this. Do you have the possibility to test this using a different PC?
we have tested the PCAN-ISO-TP example "07_classic_can_read_write" on a clean Windows 11 PC, using the latest PCAN-ISO-TP and having installed the latest device drivers and PCAN-Basic API (using the PEAK-Drivers Setup) and also installed the latest Python version, v3.11.3, and with some adjusment we were able to successfully run the sample.
First of all, it seems there is a change in the way how external library paths are resolved, beginning with Python v3.8, as described in the article "DLL not found after switching from Python 3.7.6 to Python 3.10.3" from stackoverflow. Moreover, a new function was included to handle with library paths, os.add_dll_directory. The help of it states:
.
The sample ran by removing the PCAN-ISO-TP.dll from the project folder and copying it into the WIndows\System32 folder. Note that the PEAK-Drivers Setup also copies the needed PCAN-Basic.dll into this folder. Having these two libraries in this folder the sample application works as expected.
You mentioned alraedy, that you are copying the files in the WIndows\System32 folder, so this workaround may not work for you, and you may be experimenting a different or additional problem we are not aware of. Unfortunatelly, we cannot reproduce this. Do you have the possibility to test this using a different PC?
Best regards,
Keneth
Keneth