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.
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.
10-12-2017 05:00 PM
Hi all-
Someone from another company who works with ours sent a DLL created in LV, but we couldn't reference it. My next thought was to find a .NET project and DLL that NI had built, to eliminate glitches on the DLL creation side, but those examples are pretty old.
I've done a bit of searching, but can't seem to find *recent* examples of Labview DLLs that have been created for .NET (VB or C#). The ones I can find are:
https://forums.ni.com/t5/LabVIEW/Calling-Labview-DLL-from-a-C-app/m-p/116632?requireLogin=False
http://www.ni.com/example/31050/en/
I've got LV RT 8.5 installed (Windows 7, x64), but can't seem to get those examples to run.
When I try to run these .NET program (with the LV DLL provided), no matter which platform (x86 or x64 or Any), I get an error; either 'BadImageFormatException' (0x8007000B), or 'LoaderLock Detected'.
Any thoughts on this?
Thanks.
Solved! Go to Solution.
10-12-2017 11:32 PM
Well, Let's try this (Attached)
A Hello World'Built as a .NET with Installer
Source and builds attached
The installer does not contain the LVRTEversion2017 available here
10-13-2017 06:09 AM
If you want a normal dll to get started with API programming try
MessageBoxA from user32.dll
It has an integer, two strings, then another integer. Both integers can be 0, so it should be very easy.
You seem to be confusing .dll and .net a bit. The links you included are tutorials for normal .dll's, not .net assemblies. Do you want to use .net assemblies (also .dll's) or regular .dll's?
10-13-2017 08:25 AM - edited 10-13-2017 08:46 AM
Apologies for the confusion-
Ah, I'm programming in VS Community Edition 2013 (have a small VB project, could be C# if needed). Didn't realize a distinction between .NET assemblies (.dlls) and regular .dlls.
We've been able to create a .DLL that some Labview code could use (for another project), and now, we require the opposite be done. Another collaborator is doing their work in Labview, and we need to have functionality that is in their code (this talks to some hardware, for example) be called from a VB or C# program.
So, I've been able to add the 'HelloAssembly.dll' to my VB project, which is a huge improvement. Looking through the Object browser, I see JJBInteropAssembly, and then LabVIEWJJBExports, and under it, New() and HW___32Main. By adding the namespace for JJBInteropAssembly, I can then see it in my code.
Have to install the run time library, and see what happens.
10-13-2017 09:11 AM - edited 10-13-2017 09:18 AM
... and, it works!
So, the upshot-
1) Build a simple VB .NET application.
2) Add the DLL above; also, don't forget to all the imported namespace JJBInteropAssembly
3) Install the LVRTEversion2017
You can then add something like button 'btnHello', and use this snippet of code:
Private Sub btnHello_Click(sender As Object, e As EventArgs) Handles btnHello.Click
Dim test As Boolean = False
Dim testout As Boolean = False
Dim sTest As String = "abc"
test = LabVIEWJJBExports.HW___32Main(sTest, testout)
MsgBox("test, testout = " & test & " " & testout)
End Sub
A popup message box with the Labview icon will show up, with the text 'abc' in the button. The local MsgBox will show test and testout.
From what I understand, what was built was a .NET DLL, not a 'regular' DLL. I'm wondering if you can also create DLLs that can be called by things like Python (a story for another day), but also potentially useful.
10-13-2017 11:41 AM - edited 10-13-2017 11:55 AM
Outstanding!
And yes that could have a Build Specification for a Shared Library DLL as well as a .NET interop Assembly DLL from the same source
(Could also make it an executable with command line parameters)
as in cmd <MyHW.exe> -"Okey-Dookey"
There are simillar build specs available for those Eunuchs and operating systems that can't figure out if they are Scot or Irish
By the way. I'm curious if my 8-Ball logo showed up nicely during the install?
▼▼▼ that one
10-30-2017 12:12 PM
The "install" was me putting the HelloAsembly.dll in the correct directory; there was no spinning 8 ball. The zip file wasn't an executable...
11-07-2017 03:32 PM
Some quick question addendums:
a) If you want to create a void function, is this defined as a subroutine, i.e.:
Declare Auto Sub MyDLLRoutine Lib "..\LabVIEW\MyDLLRoutine.dll" (byval input as single)
instead of a function?
b) How does one handle arrays (input and output)? I see this:
https://forums.ni.com/t5/LabVIEW/LabView-Net-Interop-and-Arrays/td-p/3183711
... but this is C#.
07-23-2018 07:10 AM
Here we are talking about dll file, in your problem statement for creating dll for vs.net community. You need to download this missing .https:fixdll.net/activation.dll file, to fix this issue. Running this file after that your problem would be fixed.
07-25-2018 03:43 AM
In my previous comment url is incorrect. So new url is https://fixdll.net/d3d9