Now that you have the external function declared in DAQFactory using extern:
extern("labjackud.dll","long ListAll(long, long, long[1], long[128],long[128],double[128]","LJListAll","stdcall")
you can now call the function. Calling the function is as simple as calling any other function in DAQFactory. In fact, if you do not have any pointers in your external function, then it is identical. In this example and in many real cases, however, you have to provide pointers. To specify a pointer, you should put the at symbol (@) in front of the name of the variable you wish to point to in the function call. For example:
global numfound
global sn
global id
global address
global err
err = ListAll(9,1,@numfound,@sn,@id,@address)
As you can see, we declared several global variables, and then pointed to them in the function call to LJListAll by putting their names in quotes in the function call. If you've not guessed it already, the only thing you can provide a pointer to is a variable. This can be a global or a private variable. It cannot be a channel or system variable. Also you cannot subset the variable, so @numfound[0] is invalid.
As you may be able to tell also from the above example, you do not need to preallocate your arrays. DAQFactory will take care of this automatically for you. The same goes for strings:
extern("labjackud.dll","void ErrorToString(long, string[256])","ErrToString","stdcall")
global strError
ErrorToString(1001,@strError)
Notice how we didn't predefine strError to 256 characters.
To pass a null pointer, simply use the NULL constant:
ErrorToString(1001,NULL)
Of course you wouldn't want to pass a NULL to this particular function since it would do nothing, but you get the idea.