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: 

Error 1097 when calling DLL

I have looked around on several of the other posts about this problem, and I haven't found the clue to fix my problem.

 

When I call my dll I get error 1097, so I have misconfigured the library call, but I can't figure out what is wrong. I know that it is something about the arrays, because if I use one of the functions that doesn't involve them (this is not included in the zip file), everything works. Everything is built and compiled by LabView 2012 (32 bit) on Windows 7 (64 bit).

 

Prototype: int32_t InitializeModule(uint32_t InputSourcesLength, ClusterArray *InputSources, uint32_t *OutputNamesLength, LStrHandleArray *OutputNames, uint32_t InputSourcesDependency[], LVRefNum *ConfigClusterRefnum, int32_t len)


Test.vi is a quick test of the DLL (you need to set path to the DLL yourself though). If everything works, it should come up with a dialogue (seen in dialogue.vi) asking for some input. InitializeModule.vi is the VI being called in the DLL.

0 Kudos
Message 1 of 6
(3,040 Views)

I haven't installed LabVIEW 2012 yet, but if you either save your code back to 2011, or post a screenshot of both the Call Library Function Node configuration and the VI that uses it, I'd be happy to take a look.

 

Do you intend to be using the LabVIEW-specific datatypes LStrHandleArray and LVRefNum?  When you say "everything is built and compiled by LabVIEW 2012" do you mean you built the DLL in LabVIEW, and you're trying to call it from LabVIEW?  If so, why not just call the VIs directly?

0 Kudos
Message 2 of 6
(3,025 Views)
I have attached a 2011 version of all of the code. The program that I am creating is part of an experiment, and custom modules needs to be loaded at runtime. Multiple input and output have to be supported as well. The refnum is a configuration cluster associated with this instance of the module (as I don't know anything about the content of these clusters, I store them in an array of generic refnums), and the string array is a name on all outputs (to make it easier for the user to distinguish them when picking inputs for another module. I might have missed it, but the only way that I know to load and call VIs at runtime, is if it is a DLL file. But please do correct me if I am wrong, DLLs with LabVIEW specific types are a pain.
0 Kudos
Message 3 of 6
(3,008 Views)

I don't see the attached code in LabVIEW 2011.

 

It is possible to load and run a VI at run-time.  You can find examples of plugin architectures in the LabVIEW example finder and on the NI website.  You open a reference to a VI on disk using Open VI Reference and then run it using Call By Reference.  You can also use an invoke node with the method set to Run, but newer versions of LabVIEW (since 2011, I believe) include an asynchronous Call By Reference that makes the Run method mostly obsolete.

0 Kudos
Message 4 of 6
(2,993 Views)

I have tried to reattach the zip file .. not sure what went wrong the first time, I was sure that I did attach it 🙂 Oh well ...

 

And thank you for mentioning Call By Reference, it makes it so much easier! As I am probably going to use that approach, debugging the attached code is no longer needed.

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

A DLL only contains the binary code of the function and no declaration of the interface at all. As such we can not really help you with only the DLL and VI at hand. We need at least the C function prototype of the DLL function too, which you would typically find in a header file. And of course any secondary header files that define types used in the function prototype declaration.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(2,962 Views)