NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

prototype for a .net dll

This should be a relatively simple question to answer.
 
I have a function in a class and need to know how to pass the sequence context. My function is entering when I only have the parameter input, but pestering me everytime I step into it about Teststand not being able to step into the function. When I try passing in the sequence context, I get the folllowing error:
 
The .NET parameter 'seqContextDisp' could not be accessed.
Unable to cast object of type 'System.__ComObject' to type 'System.UIntPtr'.
 
I am passing in the field "ThisContext". What am I doing wrong?
Also, there is an entry for Object reference. What is that for? I have "create object" selected. Should I have the entry "Dispose checked"?
 

namespace

cpp_example_dll {

public ref class Class1 {

   public: void test1_function(TS::SequenceContext *seqContextDisp, int parameter) {

   // How to access the sequence context

   PropertyObjectPtr context = seqContextDisp;

   tst = context->GetValNumber(

"Locals.ThisTest",0);

0 Kudos
Message 1 of 5
(3,424 Views)

Hi Steve,

In this thead there is a simple Example

http://forums.ni.com/ni/board/message?board.id=330&message.id=17663&query.id=73821#M17663

Most important hint for writing C# code: THERE WILL BE NO POINTERS, do it with references

Hope this helps

Juergen

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 5
(3,407 Views)
But I'm using CPP.
0 Kudos
Message 3 of 5
(3,393 Views)
Hi Steve,
 
I assumed your are doing your stuff in C# when I read ".net"
Ok in C(++) you can use your all your pointers.
 
Just one question. Why are you using the TS/.net Library instead TS/C++ ?
With C++/.net you have unmanaged and managed code alltogether. And most times
you have to marshalling the objects.
 
Greetings
 
Juergen
 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 5
(3,374 Views)
I found out the I was using the CPP libraries and was able to get it to work using the .net libraries instead. CVI is my first choice for anything, but my application requires the use of .net. I'm using CPP because I need features of both.
0 Kudos
Message 5 of 5
(3,370 Views)