Control LabVIEW DLL from LabWindows GUI only
Hello,
I have been developing an application in LabWindows/CVI and have recently built some auxiliary applications in LabVIEW. My goal is to make the LabVIEW applications into a DLL and call them from the LabWindows app; however, one of my LabVIEW VIs has a front panel control and a local variable to stop a pair of asynchronous while loops. What I would like to do is remove/hide the front panel of this LabVIEW VI and control the VI from the LabWindows GUI exclusively. Is this possible?
Thanks!
Slowpoke
Slowpoke
CLAD (believe it or not!), using LabVIEW 8.5
They don't call me "Slowpoke" for nothin'!
Hi, David,
Once I figured out how to make a front panel control into a parameter, I had what must be a common reaction among LabVIEW users: Can it really be that easy? Thank you for your reply and your assistance.
Slowpoke
Slowpoke
CLAD (believe it or not!), using LabVIEW 8.5
They don't call me "Slowpoke" for nothin'!
Similar Messages
-
Access labview dll in labwindows
Hello,
Q1. I have created a DLL in labview8.2. I have included the header file and the library file in my LabWindows project. When I compile the code it throws up an error in header file extcode.h. I have attached the error messages with this post in a file. Can anyone please guide me fixing this error. Also related links to creation of DLLs in Labview and accesing these DLLs in CVI would also be helpful.
Q2. I have created a VI which has input parameter as a cluster. The cluster has integer data type and an array of integers. I am creating a DLL out of this VI. Are there any limitations for accessing the cluster from CVI? How do I resolve them?
Thanks in Advance,
Pradeep
Attachments:
extcode_error.txt 2 KBHello Pradeep,
The compile errors you posted seem to indicate that the header file was incorrectly generated or modified. I would suggest going over it the header file for any syntax errors in the region where the first error is thrown. You could also try to regenerate the header file by recreating the dll. I have found two links that should help you get started with using a LabVIEW dll in CVI and also using clusters with dlls. I would recommend, however, that you continue to search through the forums and Developer Zone. There is a wealth of information here that is very helpful.
KnowledgeBase 3337DOV4: Calling a LabVIEW DLL from a CVI or other C/C++ project
NI Developer Zone Example: Using Structures in a DLL with Clusters in LabVIEW
Adam
National Instruments
Applications Engineer -
Hi,
I'm having trouble calling labview dll from C# to perform certain function.
The function supposed to return the values in the float Analysis[] array. However, when I execute it it only returns zero values.
It seems that some parameters are not properly passed to the dll.
Below is the function in the header file:
void __stdcall Optical_Center(char FileDirectory[], long ImagePtr,
short int Height, short int Width, char ReadFromFile, float Analysis[],
long lenAnalysis);
and my corresponding dll import in c#:
[DllImport(@"SMIA.dll", CharSet = CharSet.Ansi)]
public static extern void Optical_Center([MarshalAs(UnmanagedType.LPStr)]string FileDirectory, long ImagePtr,
short Height, short Width,char ReadFromFile, IntPtr Analysis,
long lenAnalysis);
string str = @"C:\SMIA.raw";
int len = 3;
long m_lenAnalysis = 3;
long m_ImagePtr = 0;
short m_Height = 2464;
short m_Width = 3280;
IntPtr m_PtrArray = Marshal.AllocHGlobal(len * Marshal.SizeOf(typeof(float)));
char m_ReadFromFile = '1';
Optical_Center(str,m_ImagePtr,m_Height,m_Width,m_ReadFromFile,m_PtrArray,m_lenAnalysis);
float[] m_Analysis = new float[len];
Marshal.Copy(m_PtrArray, floatArray,0,len);
Marshal.FreeHGlobal(m_PtrArray);
string printstr = "";
for (int i=0; i<len; i++)
printstr = printstr + floatArray[i].ToString() + "\n";
MessageBox.Show(printstr);
Appreciate if anyone can help, thanks.
KLI was just about to post the header file of the DLL, when
I noticed that there's a function called LVDLLStatus.
This little thingie turned out to be a rather handy tool.
With that function I found that in the DLL I had a problem
with another function that prevented the DLL to be correctly
loaded.
This other function in the DLL is for generating digital output
and it worked as it should, when tested from LV.
Anyway if someone is interested, I got it working by using
the LoadLibrary and GetProcAddress function, as in the
source code thatI posted earlier.
I will investigate what is wrong with that digital output, and
post into a another thread if I have problems with that. -
How to call a labview dll from excel-VBA?
How to call a simple Labview DLL from Excel VBA?
I have seen examples of DLL calls from VB but does it work the same way for VBA? I have 2000 excel and Labview 8.5. I created the DLL and tried to call it from VBA using the same type of code as in NI's website example(ofcourse its a bit diff with 8.5)
http://zone.ni.com/devzone/cda/tut/p/id/...
BUT it errors out when called from excel
ERROR: The object invoked has disconnected from its clientYou would need to provide more details about the LabVIEW DLL, such as the prototypes of the functions (VIs) that you're trying to call, and your actual VBA code. Specifically, what object you're trying to create. You should also make sure the Run-Time Enginer is installed, as well as any required libraries such as the VISA Run-Time if you're using VISA. Have you made sure to enable the ActiveX server for the DLL?
A search yielded the following items that you may wish to peruse:
http://forums.ni.com/ni/board/message?board.id=170&message.id=261345&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=45099&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=299209&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=195846&requireLogin=False -
[Q] Using a VC++ DLL from LabWindows
I need to create a DLL that uses shared memory. I can do
this with Visual C++ but haven't succeeded doing it with
LabWindows.
So now I want my LabWindows executable to use the VC++ DLL.
I'm having trouble because some identifiers are "redefined"
(defined both in the needed VC++ include files as well as in
CVI include files).
Can someone tell me either how to create a DLL that uses
shared memory in LabWindows (this is my preferred solution)
or else how to use a VC++ DLL from LabWindows?
My ultimate aim is to use the shared memory to share
instrument session handles, since we need to be able to talk
to the same instrument from more than one process. Has
anyone already done this?
TIA for any help ...
B
* S
ent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!Hello andre,
today I have read your message of the 20th Sept. 1999 in the NI-Newsgroup.
And I am also trying to use SHARED MEMORY.
But I have no experience with it. Could you help me?
Do you have succeded ?
With best regards,
CHRISTIAN ZIPPER
ande schrieb in im Newsbeitrag:
[email protected]..
> I need to create a DLL that uses shared memory. I can do
> this with Visual C++ but haven't succeeded doing it with
> LabWindows.
>
> So now I want my LabWindows executable to use the VC++ DLL.
> I'm having trouble because some identifiers are "redefined"
> (defined both in the needed VC++ include files as well as in
> CVI include files).
>
> Can someone tell me either how to create a DLL
that uses
> shared memory in LabWindows (this is my preferred solution)
> or else how to use a VC++ DLL from LabWindows?
>
> My ultimate aim is to use the shared memory to share
> instrument session handles, since we need to be able to talk
> to the same instrument from more than one process. Has
> anyone already done this?
>
> TIA for any help ...
>
>
> B
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
> The fastest and easiest way to search and participate in Usenet - Free!
> -
How to call Labview DLL from VB2005
Dear all expert,
I'm a student and very new in Labview programming.
Currently i have build a simple vi and need to convert it to dll so that i can call it from my VB.net. But the problem is how to call the labview dll from my VB.net?
I know we must declare function something like this,
Auto function Bodeplot Lib"..\\Bodeplot.dll" (Byval Val1 as double, Byval Val2 as double,...) as double
but how to determine Val1, Val2 (and so on) is input for which data? if my vi have 10 input (frequency, Kc,Fcz,Fcp,Wzrhp,Wp,k,Wz,Beta and Operation) ? and how to select the output (my application have 3 possible output : magnitup loop,phase loop, and degree loop)
In addition, since I'm using Labview 8.0 , and as i know apllication builder for this version cannot convert vi to dll which contain Mathscript (but unfortunely, my vi all use Mathscript), so really hope someone can help me to convert my vi to dll using Labview 8.2 (which remove this limitation).
here I'm attach my Vi and really hope someone willing to help.
Thank you.
Attachments:
bodeplot.vi 1049 KBOn Sep 17, 6:40 am, cckoh <[email protected]> wrote:
> Dear all expert,
> I'm a student and very new in Labview programming.
> Currently i have build a simple vi and need to convert it to dll so that i can call it from my VB.net. But the problem is how to call the labview dll from my VB.net?
>
> I know we must declare function something like this,
>
> Auto function Bodeplot Lib"..\\Bodeplot.dll" (Byval Val1 as double, Byval Val2 as double,...) as double
>
> but how to determine Val1, Val2 (and so on) is input for which data? if my vi have 10 input (frequency, Kc,Fcz,Fcp,Wzrhp,Wp,k,Wz,Beta and Operation) ? and how to select the output (my application have 3 possible output : magnitup loop,phase loop, and degree loop)
>
> In addition, since I'm using Labview 8.0 , and as i know apllication builder for this version cannot convert vi to dll which contain Mathscript (but unfortunely, my vi all use Mathscript), so really hope someone can help me to convert my vi to dll using Labview 8.2 (which remove this limitation).
>
> here I'm attach my Vi and really hope someone willing to help.
>
> Thank you.
>
>
> bodeplot.vi:http://forums.ni.com/attachments/ni/170/272124/1/bodeplot.vi
If you insist on using Labview with your project then you should
consider using ActveX in place of using a dynamic link library to
interface to your VB.net code. You don't need "Application Builder"
if you use ActiveX. The Student, Basic and Full development versions
of Labview for Windows come with ActiveX capability. For more
information on ActiveX look up the subject ActiveX in Labview's Help
File.
Howard -
How to call LabVIEW dll from ATL COM dll
I have tried to call simple LabVIEW 8.6 Dll from win32 test application, class Library.
I have include LabVIEW generated SharedLib.h file and SharedLib.lib file in the test application which I created as simple win32 console project and also from win32 class Library. I was sucessfully able to call my LabVIEW dll funtion.
But when I create ATL COM project and try to add SharedLib.h file and SharedLib.lib file I used to get following erors
Error 1 error C2733: second C linkage of overloaded function 'StrCatW' not allowed d:\program files\national instruments\labview 8.6\cintools\extcode.h 463
Error 2 error C2733: second C linkage of overloaded function 'StrCpyW' not allowed d:\program files\national instruments\labview 8.6\cintools\extcode.h 464
Error 3 error C2733: second C linkage of overloaded function 'StrCpyNW' not allowed d:\program files\national instruments\labview 8.6\cintools\extcode.h 465
Error 4 error C2733: second C linkage of overloaded function 'StrCmpW' not allowed d:\program files\national instruments\labview 8.6\cintools\extcode.h 466
Error 5 error C2733: second C linkage of overloaded function 'StrCmpNW' not allowed d:\program files\national instruments\labview 8.6\cintools\extcode.h 467
these many errors.
Will some one explain me how to call LabVIEW dll from ATL COM dll.
Thanks & Regards,
JayI also had this problem. My application is unicode-aware, but I was attempting to link it to a library with primitive C-string arguments. You could dynamically load the DLL as suggested (more work), modify the header files (really not recommended), or if you are feeling lucky you could try fooling the compiler, as I was successfully able to do in Visual Studio 2010, by steering the preprocessor around those functions (assuming you're not using them, of course -- otherwise this probably wouldn't work):
// prepare for NI extcode.h inclusion. avoid linker errors for this project.
#define StrCatW(a,b) IgnoreLinkError_StrCatW(a,b);
#define StrCpyW(a,b) IgnoreLinkError_StrCpyW(a,b);
#define StrCpyNW(a,b,c) IgnoreLinkError_StrCpyNW(a,b,c);
#define StrCmpW(a,b) IgnoreLinkError_StrCmpW(a,b);
#define StrCmpNW(a,b,c) IgnoreLinkError_StrCmpNW(a,b,c);
// header file for my LabView-built DLL (ASCII single-byte character arguments)
#include <MyLibraryHeader.h>
// clean up afterwards, put things back to 'normal'
#undef StrCatW
#undef StrCpyW
#undef StrCpyNW
#undef StrCmpW
#undef StrCmpNW -
Controlling Labview using CVI/Labwindows
I am learning to control Labview using CVI/Labwindows using activeX automation but am currently having some trouble. I am trying to modify the "CVI Controlling Labview" example to accept 5 controls as supposed to the original 4 that controls the "frequency response.vi". I am doing this by increasing the size of the "paramData" array sent via ActiveX. Do I have to change something in one of the labview controls, in order for a command to be accepted. I am already making sure the corresponding "paramNames" part of the array co-incides with the labview control name. I am using Labview 7.1 and CVI/Windows 7.1.
Attachments:
cvilv.zip 407 KBHi Simy,
When you call a VI in labview the input parameters have to be defined as you would when performing a function call in C. In order to do this you must place a control or indicator on the front panel of the VI with the corresponding datatype. You must then wire the control/indicator to the connector pane for the VI (Similar to defining a function prototype).
In LabVIEW goto help>>search the labview bookshelf, LabVIEW user manual chapter 7 and look for the part on wiring the connector pane.
Hope this helps...
Tristan
Applications Engineer
National Instruments UK & Ireland -
Hi, everyone
I build a dll from labview, the prototype is : double getchannelpower(double f, uintptr_t *VISAResourceName);
I don't know how to pass VISAResourceName to this function.How can I get the VISAResourceName of this type(uintptr_t *)?
Is it related to the paremeter ViPSession in function viOpen(ViSession sesn,ViRsrc rn,ViAccessMode am,ViUInt32 ti,ViPSession vi)?
BRs,
lotusky1. uintptr_t *VISAResourceName in the labview dll is connected to viOpen function as input parameter internally.
2.I can call the labview dll in labview via CLF Node, when the VISAResourceName parameter is set to Numeric(32-bit int or 32-bit usigned int) OR Adapt to data(Handle by Value). And I got the value of the VISAResourceName parameter, which is 0; When I directly connect 0 to the dll, it still works. But in labwindows, when I pass 0 to the VISAResourceName parameter of the dll function, I got a FATAL RUN-TIME ERROR: The program has caused a 'General Protection' fault.
mkossmann 已写:
Could you check what exactly uintptr_t *VISAResourceName in your labview dll does.Might it be that it is connected to the labviews Dll internal ViOpen() ViSession output parameter ?. And the name VISAResourceName is misleading.
Another idea would be that Labview uses 32bit Unicode for the ResourceName. And you have to convert the C String to that Unicode first. -
Calling LabVIEW DLL from C with 2d array strings
I am trying to write a DLL in C that calls a LabVIEW DLL that has a
number of functions that each return a 2D array of strings which are the formatted
measurements, with column 1 being the measurement name and column 2
being the measurement. I wanted to use the 2D array of strings since
this would give a uniform interface for returning measurements. Ive
cobbled together bits and pieces of messages and example code I've
found here into something that almost works, and was hoping someone
with a little more experience in interfacing C with LabVIEW DLLs would
be able to help me.
Here's a little
snippet from the header file generated when building the LabVIEW DLL:
typedef struct {
long dimSizes[2];
LStrHandle String[1];
} TD1;
typedef TD1 **TD1Hdl;
long __cdecl TestVI(char serialNumber[], TD1Hdl *formattedMeasurements, char ErrorDescription[], long len);
The "TestVI" VI generates a 2D array of strings. The cell contents and number of rows are random to
simulate different measurement names and measurements.
Here's a snippet for the wrapper class:
class CArgoTestsLabVIEW
public:
CArgoTestsLabVIEW();
virtual ~CArgoTestsLabVIEW();
// test modules called from parent DLL
BOOL GetResult_LV(CString resultName, double *result);
long TestVI_LV(CString serialNumber);
private:
TD1Hdl m_LVStringArray;
CMapStringToString m_resultMap;
InitMeasurementsArray();
PopulateResultMap();
The "m_LVStringArray" is intended to hold the 2D array of strings that
the test modules spit out. The "m_resultMap" is just for accessing the
measurements from the parent DLL via the "GetResult_LV" function.
The implementation of TestVI_LV is:
long CArgoTestsLabVIEW::TestVI_LV(CString serialNumber)
long rc = 0;
char errStr[BUFFERLEN];
strcpy(errStr,"");
rc = InitMeasurementsArray();
if (rc == 0) {
rc = TestVI(serialNumber.GetBuffer(serialNumber.GetLength()), &m_LVStringArray, errStr, BUFFERLEN);
PopulateResultMap();
return rc;
The accessor functions InitMeasurementsArray and PopulateResultMap are:
long CArgoTestsLabVIEW::InitMeasurementsArray()
MgErr err;
if (m_LVStringArray)
DSDisposeHandle(m_LVStringArray);
m_LVStringArray = (TD1Hdl)DSNewHandle(sizeof(TD1));
// code to check for NULL
// Set number of strings in array to 0
(*m_LVStringArray)->dimSizes[0] = 0;
(*m_LVStringArray)->dimSizes[1] = 0;
// Set total size of array structure. For now it is only as big as the long variable.
err = DSSetHandleSize((UHandle)m_LVStringArray, sizeof(long));
// code to check for error
return 0;
void CArgoTestsLabVIEW::PopulateResultMap()
int numberOfResults;
int i;
int charCnt;
numberOfResults = (*m_LVStringArray)->dimSizes[0];
if (numberOfResults == 0) {
return;
m_resultMap.RemoveAll();
for (i = 0; i < numberOfResults; i++) {
charCnt = (*((*m_LVStringArray)->String[i * 2]))->cnt;
(*((*m_LVStringArray)->String[i * 2]))->str[charCnt] = '\0';
charCnt = (*((*m_LVStringArray)->String[i * 2 + 1]))->cnt;
(*((*m_LVStringArray)->String[i * 2 + 1]))->str[charCnt] = '\0';
m_resultMap.SetAt((LPCTSTR) (*((*m_LVStringArray)->String[i * 2]))->str, (LPCTSTR) (*((*m_LVStringArray)->String[i * 2 + 1]))->str);
The problem I have is that I eventually get an access violation from
the run-time engine if I try to call the test VI in a loop. I'm
obviously having a memory management problem, but it escapes me as to
where the problem is. Anybody have any ideas?smercurio_fc wrote:
The problem I have is that I eventually get an access violation from the run-time engine if I try to call the test VI in a loop. I'm obviously having a memory management problem, but it escapes me as to where the problem is. Anybody have any ideas?
(*((*m_LVStringArray)->String[i * 2]))->str[charCnt] = '\0';
Hi smercurio,
Have you solved this? I don't work with C much anymore, but it looks, here, as if the memory at str[charCnt] isn't yours to address/change.
Is index "charCnt" one char past the end of the String-memory allocated by LabVIEW?
just an idea!
Hmmm, maybe page 9 is a bit far back to fish in the unanswered posts.
Message Edited by Dynamik on 03-03-2006 02:03 AM
When they give imbeciles handicap-parking, I won't have so far to walk! -
Calling LabView DLLs from C/C++
Hi!
Is it possible to call functions in the LabView DLLs directly from
C/C++?
Functions like InvChiSquare in lvanlys.dll has "Adapt to Type" void *
parameters. How do I specify those parameters from C/C++?
I have tried to use the "Build Shared Library" function in LabView to
make a wrapper dll of the "Inv Chi Square Distrubution" vi, but when I
call this function in the dll from C/C++ the function never returns.
Other functions in the same dll that does not use functions in the
lvanalys.dll are working ok.
Regards
Hans ForssellThere are 2 great places to get infomraiton on passing data to dlls, and the data types used. First would be this manual. Using External Code in LabVIEW
The second is the dll examples that ship with LabVIEW 7.0. Go to LabVIEW 7.0\examples\dll\data passing\Call Native Code.vi -
Does creating a labview dll from simulink model require visual studio
I've asked the same question at the Simulink forums, but maybe someone here has the answer:
I'm trying to perform this process here:
http://zone.ni.com/devzone/cda/tut/p/id/3447
However, I get the following errors from the Simulink Real Time Workshop:
Error building Real-Time Workshop target for block diagram 'SensorCAN_sfcn'. MATLAB error message:
Error using ==> setup_for_visual>LocIssueMSDevError at 324
Invalid setting for environment variable MSDevDir or DevEnvDir.
The setting is: ''
You can verify the setting by checking for the existence of:
%DevEnvDir%\..\tools\vsvars32.bat (for Visual C/C++ 7.1)
%MSDevDir%\..\..\vc98\bin\vcvars32.bat (for Visual C/C++ 6.0)
%DevEnvDir%\..\tools\vsvars32.bat (for Visual C/C++ 8.0)
I do not use Visual C, what little programming I do has been done in Borland Builder or with command line gcc. Is there any way to make simulink look for a different dev environment? Or does this process require Visual C?
Solved!
Go to Solution.Thanks, I've got SIT 5.0 installled, but it turns out we have a site license for VS 2008, so I now have that as well. I've got a new problem though, and although I think it's related to Simulink, these forums seems a little more responsive than that Matlab forums. So....
I’m working with someone else's s-code, and I haven't used Simulink in the past. As I said in my original post, I am attempting to use SIT to turn the s-code into a dll for use in a LabView RT application. I opened the mdl file in Simulink, and I’m now trying to build the LabView dll in the Simulink Real Time Workshop. The target file is nidll.tlc and Matlab starts the SIT when launched, so it appears the tools are aware of each other. However, when I attempt to build the dll, I get the following error:
fatal error C1083: Cannot open include file: 'rtlibsrc.h': No such file or directory
I’m using the following: Matlab 2008b, SIT 5.0, and MS Visual Studio 2008, so the libraries and includes should be fairly up to date. What I don't get is that the files that are calling for this include are auto-generated by Simulink, so I don't know why it's not finding the rtlibsrc.h. Still, I found that in the RTW subdirectory, and copied it into my local directory. This gives me a different error:
### Linking ...
C:\PROGRA~1\MATLAB\R2008b\sys\perl\win32\bin\perl C:\PROGRA~1\MATLAB\R2008b\rtw\c\tools\mkvc_lnk.pl SensorCAN_sfcn.lnk SensorCAN_sfcn.obj rtGetInf.obj rtGetNaN.obj rt_logging.obj rt_matrx.obj rt_nonfinite.obj rt_printf.obj rt_sfcn_helper.obj nidll_main.obj rt_sim.obj SensorCAN_sfcn.res SensorCAN0_sf.obj
link /RELEASE /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll /NODEFAULTLIB:MSVCRT LIBCMT.LIB kernel32.lib ws2_32.lib mswsock.lib advapi32.lib @SensorCAN_sfcn.lnk /dll -outensorCAN_sfcn.dll
Creating library SensorCAN_sfcn.lib and object SensorCAN_sfcn.exp
SensorCAN0_sf.obj : error LNK2019: unresolved external symbol _rt_Lookup referenced in function _mdlOutputs
Again, self-generated code, now with unresolved external symbols? I'm assuming that I'm linking the wrong version of a dll or obj that contains mdlOutputs, which appears to be something from Matlab. Can anyone point me in the correct direction? Missing headers and incorrect libraries lead me to believe that I've got a search path issue somewhere, but the Matlab/Simulink/LabView/Visual Studio are all fresh default installs. -
How to call labview DLL from visual C++?
Hi,
I'm trying to call a LV DLL from a VC++ application
by using the LoadLibrary and GetProcAddress functions.
The DLL contains a simple sum function. The Library is
loaded correctly, but the result is always 0.0000.
I have loaded a VC++ DLL in a similar way and it works
correctly. Also, I have tested the DLL by loading it in LV,
and it works correctly. The calling convention is defined
to be stdcall in LV Application Builder.
I have also tried this solution, but I will get a compiler error
from one the header files that are created by the LV when
the DLL is made. The error comes from this line
typedef char int8;
and the error states that
..\fundtypes.h(107) : error C2371: 'int8' : redefinition; different basic types
If someone knows of newer tutorial(for LV 8.2) or knows how to use those
LoadLibrary and GetProcAddress function for LV DLLs, I will appreciate the
information greatly.
Below is the code that I'm using for loading the LV DLL.
Thanks
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
HINSTANCE LVLib = LoadLibrary(TEXT("Testdll"));
typedef double (__stdcall *MYPROC)(double, double);
if (LVLib != NULL)
MYPROC ProcAdd = (MYPROC) GetProcAddress(LVLib, "Add");
if (ProcAdd != NULL)
double d = (ProcAdd)(5.5, 6.6);
printf("sum = %f\n", d);
else
printf("Invalid function pointer\n");
else
printf("Failed to load the library\n");
return 0;I was just about to post the header file of the DLL, when
I noticed that there's a function called LVDLLStatus.
This little thingie turned out to be a rather handy tool.
With that function I found that in the DLL I had a problem
with another function that prevented the DLL to be correctly
loaded.
This other function in the DLL is for generating digital output
and it worked as it should, when tested from LV.
Anyway if someone is interested, I got it working by using
the LoadLibrary and GetProcAddress function, as in the
source code thatI posted earlier.
I will investigate what is wrong with that digital output, and
post into a another thread if I have problems with that. -
Error while caling Labview DLL from VB2005
Dear all expert,
i'm a student and very new in Labview. Currently, i design a application using Labview8.2 and need convert it to dll. So that i can call it fom my VB2005.
I'm encounter an error, there is my computer "hang" when calling the labview dll. I suspect this may due unproper way i calling the labview dll in my VB program. So, really hope some one can give me any suggestion and modification to my program. I attach my vi and Vb program.
for your information,
i already install labview run time engine 8.2.1 and uncheck the "Loader Lock detected".
below is the Function Prototype create when i using Application Builder to build the dll.
void Bodeplot(unsigned short Operation, double Beta, double Frequency, double Kc, double Fcz, double Fcp, double Wz, double Wp, double Wzrhp, double k, double *Output)
Thank you very much.
Attachments:
MyProgram.zip 723 KBHi cckoh,
A couple suggestions include:
1) Make sure you are using the correct .NET data types that map to the data type that LabVIEW uses. For example, your Operation paramter for your DLL is an unsigned short which is equivalent to a System.UInt16 in .NET.
2) You should be using ByRef instead of ByVal for your output parameters. For example, in your function prototye, you have double *Output. For example, when you import your unamanged DLL, the prototype you should use woudl be:
Declare Auto Function Bodeplot Lib "........."(ByVal Operation as System.UInt16, ........ ByRef Output as Double)
I tested this out and it loads the DLL, calls the function, and returns without problems.
Hope this helps!!
Best Regards,
Jonathan N.
National Instruments -
How to control labview VI from a program not written in LabView on another computer?
I am tasked with finding a way to control (an existing) LabView application (VI) from another computer (networked together) as part of a larger application which is not constructed in LabView (likely C# .Net Windows app).
So, I am looking to find a solution that
a) requires minimal change to the existing stand-alone LabView VI
b) does not require LabView on the remote (controlling) computer.
Controlling the LabView application involves communicating various setpoints etc, controlling start / stop, and getting back from the application some measured data values; could be treated as file transfer or data streams.
Will it be fruitful to look into controlling the VI over TCP/IP? I gather that support exists in LabView for sending and receiving data over TCP connections. This approach would I guess require code to be added to the existing VI to handle commands and requests on the connection; simulating the ability to interact with the front panel.
Are other options available? I see in the help pages mention of DataSockets and web services among other approaches.
I am totally new to LabView, so all suggestions gratefully received, but please don't assume any knowledge of LabView.You can control LV from other applications using the ActiveX interface from VI Server. Since you want to do this from a remote machine, you would have to enable ActiveX-access using DCOM. This is a rather worksome efford and to my experience not really suggested.
So i suggest you to define a TCP-based protocol for remote control of your dedicated application. This of course is only valid, if the application is already running on the "server". So your "client" connects, sends commands which are executed by the "server" and data and status information is sent back. And you are correct that this will require (significant) changes to the LV application.
Web Services are also a valid approach if you can connect to web based applications. LabVIEW utilizes RESTful Web Services architecture. REST provides a lightweight
protocol accessible to a wide variety of clients. The architecture does not
require complex message parsing and provides a simple interface for you to begin
using Web Services
in LabVIEW.
Other methods are possible, but i recommend you to pick one of those.
hope this helps,
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Maybe you are looking for
-
I had to do a reinstall of windows 7 recently and now have had to download library access and digital editions. Can't get books to transfer correctly to Nook and can't even open them on the computer in Digital Editions. Keep getting messages that n
-
How to update password in oracle apps
Hi All, Just now I migrated the APPS to another OS. Now whenever user is logging, Application is asking to change password but its not updating the password and giving error. What can the problem. Regards Rakesh
-
Hi, I would like to know how to invoke a ESB SOAP service from an external web service, which in turn need to interact with the Routing Service ? Thanks, OracleExpert
-
IMac 24" Intel Core 2 black display on boot after update to 10.6.7
Help! After updating software to 10.6.7, my iMac won't display anything but a black screen after booting, the system seems to be working because you can figure out that the list of users is there to start up (keyboard & sounds) but no display. Things
-
Mustek P3600: how to install it without classic.
I just received a new A3 scanner, a Mustek P3600. The seller didn´t explained it only works with classic and just explained it works with Mac OSX. As macbook doesn´t support classic, I am in trouble with that. I can not install the mustek stuff (twai