08-08-2007 03:06 AM
Hi Casey,
There is no problem to pass sequence context into modules of different nature (see previous posts). Actual task is: to develop single C interface for DLL (the DLL is still in development). This interface should accept sequence context. This interface should be accessible from TestStand, LabView and another DLL (automatically supported). The problem is that TestStand and LabView provide different ways of passing sequence context into DLL. The only solution I can imagine, is to export from DLL for each function additional one. Something like this:
void __declspec(dllexport) __stdcall TheFunction(struct IDispatch ** seqContextDisp);
void __declspec(dllexport) __stdcall TheFunction4TS(struct IDispatch * seqContextDisp){return TheFunction(&seqContextDisp);}
I would like to avoid using this solution. Anyone can help?
Thanks, Misha
08-08-2007 03:44 PM
08-14-2007 11:09 AM
Hi Casey,
This is what I tried to do (see "Reply 5 of 12"), but not succeeded.
When passing "ThisContext" "By Value", the error:
"No details available.; -17502; System Level Exception."
When passing "ThisContext" "By Reference" and "By Pointer", the error:
"Could not accept the parameters passed in. Only values of type 'Object Reference' may be passed 'By Reference' for this parameter.
Error in parameter 1, 'arg1'. ;-17311; Could not accept the parameters passed in."
Can you please explain how exactly you are pass sequence context from TestStand into function with this prototype (void __declspec(dllexport) __stdcall TheFunction(struct IDispatch ** seqContextDisp)).
Thanks, Misha.
08-16-2007 10:26 AM
Hi Misha,
Thank you for your response. To pass the IDispatch ** from TestStand directly into your DLL, you should be able to use the following settings:
Category: Object
Type: ActiveX Automation IDispatch pointer
Pass: By Reference (by pointer)
With these settings, passing ThisContext as a parameter to your DLL should work great. I have tested this out on my end successfully, so I suspect that it should work correctly for you as well. Please let me know if this does not seem to work, or if you have any further questions and I would be glad to help you further.
Regards,
Casey Weltzin
Applications Engineer
National Instruments
08-16-2007 10:32 AM
Hi Misha,
I have now been able to reproduce exactly what you are seeing. I was previously passing the RunState.Engine object as an IDispatch ** from TestStand to my DLL, but passing the sequence context as an IDispatch ** gives me the same error that you reported.
I will do some more research to determine why the sequence context cannot be passed as an IDispatch** as the engine object can. How do you intend on using the sequence context within your DLL? What specific functions are you running that require the sequence context as an input parameter?
Regards,
Casey Weltzin
Applications Engineer
National Instruments
08-19-2007 04:25 AM
Hi Casey,
Within DLL sequence context used to access TestStand API.
Thanks, Misha.
08-20-2007 11:45 PM
Hi Misha,
After a lot of research, I do not think there is any way around the fact that TestStand and LabVIEW pass the Sequence Context to your DLL in different ways. What specifically are you hoping to accomplish with the TestStand API inside of your DLL? I would be glad to work with you to find a workaround.
Regards,
Casey Weltzin
Applications Engineer
National Instruments