Not Flagged 17708 0 Worker Thread ps6000.dll thread ps6000.dll!0b55fd59 Normal
Not Flagged 26188 0 Worker Thread ps6000.dll thread ps6000.dll!0b55b508 Normal
Not Flagged 25952 0 Worker Thread ps6000.dll thread ps6000.dll!0b55fd59 Normal
Not Flagged 30848 0 Worker Thread ps6000.dll thread ps6000.dll!0b55b508 Normal
Not Flagged 28256 0 Worker Thread ps6000.dll thread ps6000.dll!0b53e461 Normal
Not Flagged 24144 0 Worker Thread ps6000.dll thread ps6000.dll!0b57a356 Normal
In VS2015 I made a small dialog based EXE project and a DLL project in one solution. The EXE have two functions to load and unload the DLL using ::LoadLibrary and ::FreeLibrary, that's it.
In the DLL I have references to the ps6000.lib (in stdafx.cpp) and an include to ps6000API.h (in PicoTextDLL.cpp). When running the driver version is tells me: 1.4.4.45, which I believe is the latest.
When running the program I press the button LoadDLL.
Here I see the same problem directly, the call to ps6000EnumerateUnits hangs in InitInstance. In my original program I do not call this in InitInstance, but I call ps6000CloseUnit in ExitInstance which shows the same behavior.
So, you driver do not like to be called in either InitInstance or ExitInstance of a DLL?
Yes, the ps6000OpenUnit has been called successfully.
The problem is not as much your function calls. Both ps6000OpenUnit and ps6000CloseUnit as well as other function calls can be successfully called as long as it is not called from the DLL's InitInstance or ExitInstance methods.
It is very easily verified running my small sample.
I have used your example, and have seen it go missing in the ps6000EnumerateUnits call.
As the ps600GetUnitInfo call works, it would appear the issue is due to the ps6000.dll calling the lower level USB kernel drivers when using the other functions.
I will need to discuss this with the development team, so it may take a little while, they are currently very busy.
Is there a particular reason you need to use InitInstance and ExitInstance for your application ?
The reason for using the InitInstance and ExitInstrance is that I uses the PicoScope driver in a DLL which is manually loaded using LoadLibrary and FreeLibrary.
And by the way, it has already taken more than one month for you to answer that you will look at it.
I did look at your code earlier this month, and could see there was an issue when calling into our dll.
I have been investigating this, in particular looking at the processes involved when calling an extension DLL from a regular DLL, and have spoken with the development team. This method of calling our dll is not something they have used, so they have no immediate answers, and is new territory for me.
On opening a unit our drivers load firmware into the device, which then restarts and re-enumerates as a fully working device on the USB bus. You can see this process if you have device manager open when you start PicoScope 6, or call OpenUnit from an application. I am not seeing this happen when your dll calls OpenUnit from the InitInstance method, so maybe there is a step missing.
I will follow this up with the development team to see if there has been any progress. There are new drivers available in the recently released SDK download so I will test with these as well.