To use an external DLL in DAQFactory you must first specify the DLL file name and the various function prototypes you wish to use. You then assign each function prototype to a DAQFactory function name which you will use in the rest of DAQFactory. Typically you will want to do all this in an auto-start sequence so the DLLs are loaded immediately. Loading the DLL and specifying the prototypes is all handled by the extern function:
extern(DLL Name, Prototype, DAQFactory Function Name, Call Type, [Tip])
DLL Name: The name of the DLL you wish to load. This can just be the name of the DLL, in which case the default windows DLL search path is used, or you can fully specify the DLL path.
Prototype: The desired function prototype you wish to use. You can use multiple functions from a single DLL by simply calling extern multiple times. The proper format of the prototype is described in the next section.
DAQFactory Function Name: The name assigned to external function for use within DAQFactory.
Call Type: Also known as the calling convention. How the parameters are passed to the external function. This can either be "stdcall" or "cdecl".
Tip: The tool-tip displayed when you type in the function name in a sequence. If not specified, the prototype is displayed.
Here's an example of loading the ListAll function from the LabJackUD DLL:
extern("labjackud.dll","long ListAll(long, long, long[1], long[128],long[128],double[128])","LJListAll","stdcall")
And calling the new function from within DAQFactory:
global numfound
global sn
global id
global address
global err
err = LJListAll(9,1,@numfound,@sn,@id,@address)
Note that the DAQFactory function name does not have to be the same as the DLL function name.
This example is explained in detail in the next sections.
Note: Do not use the extern function to load .lib files. .lib files are used by linkers to identify entry points and do not actually contain code that DAQFactory can use.