03-02-2006 09:25 AM
03-02-2006 02:32 PM
08-01-2006 05:02 PM
I've been struggling with trying to pass error cluster data in and out of a Labview 7.1-built DLL from a C# program. I've found many entries in the discussion forum that come close to answering my problem but most of the discussions are dealing with C or C++ or they are dealing with passing the data from Labview to a DLL made by C or C++. Since this discussion is the most recent I've found that closely resembles my problem I'm jumping into this thread in hopes that maybe someone can help me out.
One of the challenges with C# is that you have limited use of pointers in "unsafe" code blocks. The C definitions associated with the Labview error cluster are:
typedef
struct { // The Error Cluster as a structureNote that the string member is really a Handle, .i.e., a pointer to a pointer. C# doesn't allow the use of pointers to managed data like Strings and Arrays. It also doesn't allow pointers to structures containing managed data. I have been unable to find a way to marshal data from the "unmanaged" DLL code to the "managed" C# code. I have been able to marshal in a Labview string when it is a separate parameter. The problem occurs when the LV string is a member of a cluster.