> My company markets DLLs which export a C API. We would like to
> provide a way for customers who want to call our API from LabView with
> a way to import the entire API into LabView (with close to zero
> effort), instead of having each customer manually import the API one
> function at a time. We have done this for a number of other
> languages, such as Delphi, by providing a "native language module"
> which does what's required (for instance, declare the proper function
> prototypes for the language). The developer simply includes the
> module in their project and then calls the API in their code.
>
> My question is, what's the best approach for providing such a "native
> language module" for LabView? As a LabView developer, what would you
> like to see a DLL interface package contain?
>
It is great that you are looking to do this. Many providers assume
that there is nothing easier than calling a DLL, so why do anything
else.
The simplest thing to do is to take each entrypoint that you need to
export and build a wrapper VI. A VI is the code module/function
equivalent within LabVIEW. A VI has a diagram where you will drop
a Call Library Function node, fill out the parameter and other
calling convention info using a dialog. Then you build a panel for
the VI. A panel is an interactive dialog with numerics, text, buttons,
or whatever so that the user can interact with the VI or watch calls
more easily. It is also nice to add a description for the inputs
and outputs so they are online. Then build a simple icon for the
function and connect the inputs and outputs to the icon.
The function wrappers can be saved in either a folder or in a llb,
a LabVIEW Library. You can build a custom menu to arrange the
functions other than graphical if you like.
The easiest way to get started on this would be to contact any
customers that may have already started the job. There are quite
a few examples of other libraries integrated into LabVIEW, plus it
is the same way that most I/O from NI is hooked in. One place to
look might be the DDE VIs in LabVIEW.
Depending on the function entries in the DLL, sometimes it is easier
to combine some of them using additional parameters. Each parameter
in a VI can be required, recommended, or optional. Each parameter
always has a default value, so it is very common to have fewer
functions with a few extra optional parameters.
Greg McKaskle