eaolson Posted April 25, 2007 Report Share Posted April 25, 2007 For the first time, I need to create a DLL from a LabVIEW application that can be used by external code, probably C++. There is a great deal of information on calling a DLL inside LabVIEW, but not very much that I can find about calling a LabVIEW-created DLL from an external application. Can anyone point me to any reference? NI used to have a document Using External Code in LabVIEW, but I can't find a "Using LabVIEW in External Code" sort of document. Some things are minor, for example the error cluster is defined in the created .h file as: typedef struct { LVBoolean status; long code; LStrHandle source; } TD1; That's reasonably straight-forward, but the TD1 name isn't very descriptive (I'm guessing that stands for Type Definition 1). Other clusters get TD2, etc. Is there any way to change these names to something more helpful? I worry that, if my DLL changes, these will all be renumbered, and that will make maintainability a nightmare. Other things are considerably more confusing. I have a function that returns a timestamp in LabVIEW. In the .h file, this function gets a prototype that looks like: void __stdcall GetTime(TD1 *errorInNoError, HWAVEFORM targetSTime, LVBoolean *timedOut, TD1 *errorOut); The only definition I can find for HWAVEFORM is in extcode.h that LabVIEW drops in the DLL folder: typedef IWaveform* HWAVEFORM; And the only reference to IWaveform I can find is also in extcode.h, where it is defined as: typedef struct IWaveform IWaveform; I can't find any other definition or even reference to IWaveform. Quote Link to comment
Tomi Maila Posted April 25, 2007 Report Share Posted April 25, 2007 QUOTE(eaolson @ Apr 24 2007, 06:27 PM) Some things are minor, for example the error cluster is defined in the created .h file as: typedef struct { LVBoolean status; long code; LStrHandle source; } TD1; That's reasonably straight-forward, but the TD1 name isn't very descriptive (I'm guessing that stands for Type Definition 1). Other clusters get TD2, etc. Is there any way to change these names to something more helpful? I worry that, if my DLL changes, these will all be renumbered, and that will make maintainability a nightmare. I think you can simply edit your .h file and rename the typedefs to what ever reasonable name you like. The C calls ignore the parameter names and the only thing that actually matters is the function name and the correct memory model for the parameters. QUOTE(eaolson @ Apr 24 2007, 06:27 PM) Other things are considerably more confusing. I have a function that returns a timestamp in LabVIEW. In the .h file, this function gets a prototype that looks like: void __stdcall GetTime(TD1 *errorInNoError, HWAVEFORM targetSTime, LVBoolean *timedOut, TD1 *errorOut); The only definition I can find for HWAVEFORM is in extcode.h that LabVIEW drops in the DLL folder: typedef IWaveform* HWAVEFORM; And the only reference to IWaveform I can find is also in extcode.h, where it is defined as: typedef struct IWaveform IWaveform; I can't find any other definition or even reference to IWaveform. Accessing waveforms from C is not supported. You have to use the waveform components for the connector pane of your C interface VIs. Then inside the VI compose your waveform from the components or decompose the waveform into its components depending on whether you are passing data to or from the VI. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.