Applies To:
  • CitectSCADA 1.00 1.01 1.10 1.11 1.20 2.00 2.01 3.00

Summary:
I am writing a new driver using the Citect DDK. When I start up Citect the driver DLL gets loaded, then unloaded and then loaded again!!! What is going on?

My driver uses a special board so the DLL handles the board and port initialisation as well as the normal driver functions and the driver name is configured in both the boards form (as Board Type) and the IO Devices Form (as Protocol).

 

Solution:
The problem lies in the return code in the InitCard function which your driver supplies. This function should be written to return TRUE for success and FALSE for failure.

Citect first loads the driver DLL indicated in the boards. After loading the DLL Citect will call the driver with the command CTDRV_INIT_CARD and via the common driver code (drv_com.c) this calls the function InitCard(). Normally InitCard() is used to parse the Boards and Ports forms and store all the information relivent to the driver. If you return FALSE then Citect will assume that the configuration of these forms is incorrect and will unload the DLL.

Later Citect will load the driver DLL again since this DLL name is indicated in the IO Devices form.

Remember the InitCard function should normally return TRUE to indicate success.

 

Keywords:
 

Attachments