Accessing Declared Functions


I’m trying to convert a VB module to Xojo.
There are a whole bunch of declared functions and constants for a dll that I want to access globally. Examples:

Soft Declare Function ePut Lib "labjackud.dll" ..... Soft Declare Function eAIN Lib "labjackud.dll" .... Soft Declare Function eDAC Lib "labjackud.dll" .... Soft Declare Function eDI Lib "labjackud.dll" ... Soft Declare Function eDO Lib "labjackud.dll" .... Soft Declare Function eAddGoGet Lib "labjackud.dll" .... Soft Declare Function eTCConfig Lib "labjackud.dll" ... Soft Declare Function eTCValues Lib "labjackud.dll"... etc... Const LJ_ioGET_AIN = 10 Const LJ_ioGET_AIN_DIFF = 15 Const LJ_ioPUT_AIN_RANGE = 2000 Const LJ_ioGET_AIN_RANGE = 2001 Const LJ_ioENABLE_POS_PULLDOWN = 2018 Const LJ_ioENABLE_NEG_PULLDOWN = 2019 etc...

Where should I put them so I can access anywhere in my application?

You can create a Module to contain all this. Add constants using Insert->Constant and add the Declares using Insert->External Method.

Instead of adding External Methods you can create your own methods on the module to map to each individual Declare. This can be useful if you want to do any additional processing before or after the Declare call.

Create a module (from the “Insert” menu) and use insert-external method and insert-constant. Then you can set their scope to be global.

Paul types faster than me…

Is there anyway to add all these as a group like the VB module or do I have to add each external method and constant individually?

No, you’ll have to add them individually.