08-24-2006 04:12 AM
08-24-2006 09:34 AM
08-24-2006 12:07 PM - edited 08-24-2006 12:07 PM
The part I'm not sure about is the Union. Not quite sure how Labview would handle this. But here is something to try:
Unsigned Char should be represented in Labview by a U8. Unsigned short by U16. For the union, try bundling into a cluster. First element is U32 for long. The next element is an array of U8. Before bundling, convert the array to a cluster using the Array to Cluster function. Right click on the function and select a cluster size of 10. Then bundle into the union cluster. Convert all other arrays to clusters with a size of 10.
Then bundle all other elements including the union/cluster in the same order as the C structure. It will look like this:
In CLNF, set Type = Adapt to Type and Format = Pointers to Handles.
Give it a shot, it is worth a try.
Message Edited by tbob on 08-24-2006 11:08 AM
08-24-2006 01:09 PM
08-29-2006 04:19 AM
08-29-2006 08:22 AM
Yeah, maybe you just write a wrapper vi. A very simple approach that's most likely to work would be like this:
Each element of the tagSERVICE struct should be treated as a separate argument passed into the wrapper function. Inside the function, create a variable of type tagSERVICE and copy the argument values into that variable. Then call the original function from inside the wrapper. After the call completes, you *may* need to copy some values back to any arguments that came in as pointers, depending on, well, stuff.
The wrapper function might look something like this:
void wrapper_function(unsigned char bService, unsigned char fShortCnf, unsigned short wTargetAddress, unsigned short wIndex, ... )
You still need to watch out for that "union".
-Kevin P.
09-04-2006 06:31 AM
Hello,
anybody give me some informations about creating a dll.
the pdf using externel code in LabView didn´t help a lot. Are there other tutorials or links about this theme?
Thanks in advance and have a nice week...
Nico
09-04-2006 09:28 AM
Hi Nico
If you have the source code of your DLL you can build a diffrent interface that incorporates the restrictions of labview.
If you have not, you have have to create a new DLL which calls your DLL inside and split the struct into standard C Datatypes like TBob suggested.
To create a DLL you need a C++ compliler like Visual Studio from MS.