From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL Call works fine with 1 cluster input but bombs with 2

Solved!
Go to solution

I have some problems getting my DLL to work using 2 cluster inputs.

 

 I create a simple DLL (MS C++ Express 2010) with 1 cluster and 1 struct Input and everything works.

 If I add a second cluster/struct, Labview bombs and disappears, Even if it's the same structure definition and initialization inputs.

 I'm making sure I have the struct Boundries set to 1 byte.  

 

 Any ideas?

0 Kudos
Message 1 of 6
(2,245 Views)

In the Call Library Function Node, try enabling maximum debugging and see if you get a helpful error message, or at least stop crashing.

Also, can you post your code, both LabVIEW and the relevant C++ parts?

When you say "I'm making sure I have the struct boundaries set to 1 byte" - you're using #pragma pack(1)?

0 Kudos
Message 2 of 6
(2,244 Views)

 

 Not using the #pragma pack, just setting the option for structure boundry properties in VC.

 It's been on maximum debugging but it's still crashing.

 Attached vi is nothing fancy, just trying to get 2 inputs to work.

 Hopefully something simple I'm not doing correctly. Thanks.

Download All
0 Kudos
Message 3 of 6
(2,242 Views)

Check your calling convention.  The C++ code says it's STDCALL but in the Call Library Function Node you have it configured for C.  Also, your functions should be prefaced with 'extern "C"' to get a normal-looking name in the call library function node.

 

EDIT: by the way, you might find NI's "Building a DLL with Visual C++" helpful.

0 Kudos
Message 4 of 6
(2,235 Views)
Solution
Accepted by topic author Jaez

 

 Thanks! That's exactly what was going on.

0 Kudos
Message 5 of 6
(2,231 Views)

Then you should mark Nathan's post as the solution to your problem rather than your own thank you message.  Go to the options menu to the upper right of your message to first unmark your message as the solution.

0 Kudos
Message 6 of 6
(2,223 Views)