01-14-2011 07:00 PM
How to pass data to " TD1 **TD1Hdl" data type from C# or C++?
My LabVIEW DLL has created the following *.h file.
#include "extcode.h"
#pragma pack(push)
#pragma pack(1)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int32_t dimSize;
LStrHandle OneString[1];
} TD1;
typedef TD1 **TD1Hdl;
void __cdecl StartApplet(TD1Hdl *OneArrayOfStrings, TD1Hdl *OneMoreArrayOfStrings);
void __cdecl GetWndRect(int16_t *left, int16_t *top, int16_t *right, int16_t *bottom);
long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);
#ifdef __cplusplus
} // extern "C"
#endif
#pragma pack(pop)
01-17-2011 05:10 PM
Hey Sandeepvd,
Are you trying to access a DLL created in a different language? One way you could do this is by using the Call Library Function Node.
Please expand upon what you would like this program to do.
Ricky
01-23-2011 02:02 AM
Thanks.
What I am trying to do is to pass the parameters to LabVIEW DLL (from a C#, C++ DLL) as 2 arrays of strings.
That's where LabVIEW creates the function definitions mentioned.
Thanks for CallLibraryFunctionNode. I am unsure if it is applicable. Since LabVIEW is not a parent in my case. It is a (grand)child which gets called from a child (C#/C++).
01-24-2011 05:59 PM
Hey Sandeepvd,
So just to clarify, are you wanting to create a LabVIEW DLL? And then with this DLL created from LabVIEW you want to pass parameters that originate from a third language, go to C# and then call this LabVIEW DLL?
Ricky
01-26-2011 10:45 PM
This is correct.
Thank you.
01-28-2011 08:40 AM
Hey Sandeepvd,
Take a look at this Knowledge Base Article: How Can I Pass a Multidimensional Array from Visual Basic to a LabVIEW-Built...
I hope this can help.
Ricky
03-09-2011 08:55 PM
I have run into a similar problem while writing a program using a LabVIEW generated DLL and using it in C# (VS2010). The knowledgebase article gives no useful information and is incomplete in what information it provides.
Is there any sample code or other resources relating to the subject?
03-10-2011 02:45 PM
Hey mgerceker,
I have not been able to find much about using a LabVIEW DLL with C# (VS2010), but I did find an example using VB.NET to call LabVIEW DLL's. I hope this can be of some assistance, perhaps a baseline to see how it can be done.
NI Developer Zone: Simple Example Using VB.NET to Call LabVIEW DlLs
NI Developer Zone: Using VB.NET to Call LabVIEW DLLs That Use 2D Numeric Arrays
Ricky
03-14-2011 07:42 PM
Ricky,
Unfortunately I do not have access to anything older than LV8.6 and cannot use the build scripts for them. Furthermore the pointer access scheme in C# requires the use of manual Marshalling, which makes it harder to deal with handles. I have solved my problem by reshaping my arrays in wrapper functions before and after the real function call, but I am sure there'll be consequences as far as performance is concerned.
Thank you,
Mehmet