An update is attached.
It contains:
1. visa_dyn.pas - dynamic bindings for Visa.
2. An example app for listing the attached Visa devices
3. A list of the visa routines, I used a notepad and a sheets app to create the dynamic bindings.
In the attachment I have replaced visa with visa_dyn in session.pas.
I have not thought on how to make it switchable, maybe it is possible.
The example may work, but it may not work. I have found multiple *visa32*.dll files on one of the PCs.
I have tried 6 or 7 of them.
Most load and the app gets the data, with some DLLs the COM ports are not detected (only the Visa ones), one DLL did not load, one loaded, but crashed on unloading, one loaded, but the app retrieved no data.
I tried Tektronix, Rigol and R&S. The last one did not respond to VisaSession1.Query('*IDN?'), the others did.
Edit: I forgot to take care for 64 bit Lazarus. I guess *visa64.dll shall be used, I will try it next days.
Edit2: I updated the visa_dyn and the example. The example app works when built with Lazarus64 even with visa32.dll but differently: generates exceptions with some COM devices; a single VISA device is found 3 times (twice with the same address, once with USB instead of USB0). Again, I found a *visa64.dll which seems to work normally.