DevOpen, doesn´t open in shared mode?

Hi!

I have a device created, dBASE_DEV, that creates an DBF.

I then call this device from a number of functions primarily using DevOpen in mode 0. Defined as mode 0, not relying on default 0.
This works fine when one function at a time opens the device, does it's thing, and then closes it.

But when I then have a loop that opens the device and each 10seconds scans through it just reading what´s in it, not closing it while sleeping. That function crashes when an other function opens the device.

It sounds like mode 0, shared mode, wouldn´t cause this. But Iv´e also tried mode 16, read only. But I get the same result with it crashing.
If I debug I get the error for bad handle, so I guess that the mode isn't as shared as one would think..

Am I using the device wrong? Maybe it can´t be opened from more than one function at a time?

Parents
  • Well.. I have to reply to my self I suppose.
    If I actually would RTFM, and not just glance over it, it says right there in it:
    "You can use this function to return the handle of a device that is already open. The DevOpen() function does not physically open another device - it returns the same device handle as when the device was opened. The mode of the second open call is ignored. To re-open an open device in a different mode, you need to first close the device and then re-open it in the new mode."
    In summary: it won´t open a new handle if it´s already open.
    So that answers that.

    Question remains though if the handle can be used over several clients and servers.
    It´s a little bit hard to test, but that may be the only way I suppose.
Reply
  • Well.. I have to reply to my self I suppose.
    If I actually would RTFM, and not just glance over it, it says right there in it:
    "You can use this function to return the handle of a device that is already open. The DevOpen() function does not physically open another device - it returns the same device handle as when the device was opened. The mode of the second open call is ignored. To re-open an open device in a different mode, you need to first close the device and then re-open it in the new mode."
    In summary: it won´t open a new handle if it´s already open.
    So that answers that.

    Question remains though if the handle can be used over several clients and servers.
    It´s a little bit hard to test, but that may be the only way I suppose.
Children
No Data