Can you right-click on your gpib-32.dll and tell me what version it says? I have done some testing and I have been unable to reproduce this problem. My code is pretty simple. The notify callback function simply releases the semaphore. I seem to be able to run this all day using NI-488.2 2.1. (This does not imply that something is wrong with your code, but somehow our two tests do not seem to get the same results. I hope we can find out the differences!)
Second note: Have you considered using NI-Device? NI-Device is designed for device-side applications and may make all of your problems go away. It is something to consider.
My Code (snippet):
FunctionName ()
{
// Open handle to GPIB 1, set pad and TMO
// so that I have time to manually talk to
// this device.
l_DeviceHandle = ibfind ("GPIB1");
ibrsc (l_DeviceHandle, 0);
ibpad (l_DeviceHandle, 3);
ibtmo (l_DeviceHandle, T300s);
// Loop a few times reading from the "controller"
// and sending back a response.
for (int i = 0; i < 3; i++)
{
ibrda (l_DeviceHandle, l_Buffer, 100);
ibnotify (
l_DeviceHandle,
TIMO | CMPL,
CallbackFunction,
NULL
);
WaitForSingleObject (
g_Semaphore,
0xFFFFFFFF
);
// Call ibwait to get updated global variables
ibwait (l_DeviceHandle, 0);
l_Buffer[ibcntl] = '\0';
printf ("Received Buffer = %s\n", l_Buffer);
ibwrta (
l_DeviceHandle,
"Got Buffer",
strlen ("Got Buffer")
);
ibnotify (
l_DeviceHandle,
TIMO | CMPL,
CallbackFunction,
NULL
);
WaitForSingleObject
(
g_Semaphore,
0xFFFFFFFF
);
}
ibonl (l_DeviceHandle, 0);
}