pfroud / JVisa

Java library for VISA (Virtual Instrument Software Architecture) instruments
Apache License 2.0
42 stars 14 forks source link

Changed so that native library name can be specified in the constructor. #7

Closed penguinlab closed 1 year ago

penguinlab commented 1 year ago

Thank you for publishing this very useful library. I have used this library to operate the following two instruments via Keysight IO Libraries Suite.

Native library name in Keysight IO Libraries Suite is iovisa.so (on Linux) and visa32.dll (on Windows). Therefore, I added a constructor that allows specifying the library name so that it can be used with other VISA library implementations.

I would be happy to merge this change if you would like.

pfroud commented 1 year ago

I'm glad you like JVisa and thanks for submitting this pull request :)

Can you confirm that the current JVisa code does not work with Keysight IO Libraries Suite?

On Windows, JVisa will already use visa32.dll.

On Linux, JVisa will try to use libvisa.so. I think libvisa.so points to a vendor-specific native library file (nivisa, agvisa, tkvisa, rsvisa, iovisa, etc).

penguinlab commented 1 year ago

Thanks for the reply.

Can you confirm that the current JVisa code does not work with Keysight IO Libraries Suite? On Windows, JVisa will already use visa32.dll. On Linux, JVisa will try to use libvisa.so. I think libvisa.so points to a vendor-specific native library file (nivisa, agvisa, tkvisa, rsvisa, iovisa, etc).

I am using the following environment.

I checked and it seems that Keysight IOLS (for Linux) does not install the native library named libvisa.so. The following is the result of the locate command.

[root@localhost ~]# updatedb

[root@localhost ~]# locate visa64.so

[root@localhost ~]# locate visa.so
/usr/lib64/libiovisa.so
/usr/lib64/libivivisa.so
/usr/lib64/libivivisa.so.0
/usr/lib64/libivivisa.so.7.0.0

I also thought libvisa.so would be installed as an alias for the native library, but it may be handled differently depending on the manufacturer from which it is provided.

penguinlab commented 1 year ago

Incidentally, PyVisa also automatically detects native libraries, but seems to have an API for explicitly specifying their location.

https://pyvisa.readthedocs.io/en/latest/api/visalibrarybase.html

pfroud commented 1 year ago

Thanks for sharing those details, it looks like this is a good feature to add!