Call dll's function
In order to call dll's functions in a program, written in graphical
programming langage (labview), I would like to understand the arguments
of these functions.
How can I know, or where can I find the values of the dll's functions
arguments ?
For exemple, play a midi file with mciSendString of winmm.dll.
May be you can find docs for standart Windows API function in help for
Borland C++, or Visual C++.
Vincent Chollet wrote:
> In order to call dll's functions in a program, written in graphical
> programming langage (labview), I would like to understand the arguments
> of these functions.
>
> How can I know, or where can I find the values of the dll's functions
> arguments ?
>
> For exemple, play a midi file with mciSendString of winmm.dll.
Similar Messages
-
I want to call the WinAPI function-animatewindow in user32.dll to produce some special effect when showing or hidding windows, but i don't know how to using this Win API to achieve my purpose?
Does anyone have an example VI about this application?
Thanks in advance for your help.You have to use the Call Library Function Node to call Windows API functions. The animatewindow function itself has some pretty simple parameters. You first need to get the window handle. There are a set of Windows API Function Utilities (32-bit) for LabVIEW that you can use. In there there is a VI (Get Window Refnum) that gets the window handle. It's a simple call to a Windows API function. You would call the animatewindow function in the same way. In this case there are 3 parameters: the window handle (returned by a FindWindow API call), a DWORD (32-bit integer) for the duration, and another DWORD for the flags.
-
Error 1097 after calling dll function which allocates memory inside
Hello!
When a call one my functions in my dll from LabView, i get an error 1097. My function takes a few arguments and then allocates some memory for measurement.
It's not returning any pointers to that memory area, it is just allocates that memory for itself. I don't know what could be the problem, probably i am missing something.
Could you help please?
Best regards,
Tamas
Solved!
Go to Solution.Are you sure that the allocate function is the problem?
Error 1097 simply means something inside the external code wrote into memory locations that it was not meant to write. That is usually because of output buffer parameters that are not allocated (large enough) in LabVIEW when passed to the external code fucntion, so the function assuming it received a buffer of a certain size happily writes into that buffer but overwriting other information it should not have.
But that is by far not the only possibility to cause this error. A simple bug in the external code can cause the same problem when a pointer goes astray or such. The fact that you used that library elsewhere already without seeing any problem is unfortunately no guarantee that the function is not buggy. The LabVIEW exeception handling around the Call Library Node has gotten rather picky and can detect violations that do not have to cause visible problems at all. But the violations it detects are real violations so just silencing them is not a good idea, as they could cause all kinds of problems including overwriting vital data structures in your program that either cause a crash later on or simply wrong results in other parts of your program. Especially the last one is a total bummer to debug.
Without seeing much more of your code it is basically impossible to point out where the problem could lie. The particular Allocate function doesn't look like there is much that could be done wrong, but I would assume that you call several other functions too somewhere, which could cause the problem. If you can absolutely positively say that you never ever call any library function with a to short (or unallocated) buffer parameter, then you will have to take it up with the manufacturer of your lib, as it would seem very likely that there is some problem in there.
Also you pass a handle to the library function but your Allocate function does not have this as a parameter! Where does this handle come from? Are you sure you have allocated and prepared it properly before calling this function? A handle is quite often a pointer, although usually a so called opaque pointer meaning the user of the library does not and should not know anything about the structure this pointer points to. It is only known internal to the library.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Call a special function in the dll using Call Library Function Node????
Dear all,
I am calling a special function in the dll using call library function node. There is a input parameter that it is a enum type in this function. I don't know how to deal this parameter for calling this function.Has anybody solved this problem?Please advise!
I am appreciated of you anytime.Most of the times an enum is just a U8/U16/U32, internally so probably you can call it with just a U8/U16/U32 or something. For the correct value you have to look at the definition.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
Calling a native function from a dll
Hi all,
I want to call an api function exported from a dll using java. For example l like to call a function from kernel.dll (Windows). How can i do this. Do i have to create another dll for this?hi,
you need to use JNI
you have to create de DLL , and call kernel32.dll in.
like that:
java_class.class ==> first_dll.dll ==> kernel32.dll -
HI!
What's the best way (and simple) to call DLL function from JAVA.
DLL function (developed in C) has two input parameters (string) and return an integer.
Could you help with an example?
Thanks a lot.Do a google search for 'JNI tutorial' and it will turn up hundreds of examples.
-
Is it possible to call dll-functions with records/types as arguments?
or must I use the fixed preselection of types
LabVIEW must call DLLs with data types it is compatible. Therefore, you must use the types available through LabVIEW.
I have two pieces of advice on this matter:
First, contact NI and get their advice on how to call your data type. They may be able to offer a very quick solution.
Second, if you cannot call these data types, and you have a compiler, I would suggest "wrapping" the DLL inside another, and 'translate' the data type from something LabVIEW can handle, to the type needed by your DLL in this 'wrapper' DLL. -
I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows
User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with
various other defined input variables to access the sting.
I have no experience of using this 'Call Library Function Node', but have an understanding of the 'C' programming language. Does anyone have
example Labview code showing how this might be done.
ThanksIf you're trying to access information that's being displayed in the window of another application and that application has no ActiveX interface, then yes, Windows calls can be used. There's a very good example on calling DLLs that ship with LabVIEW. Open the Example Finder (Help->Find Examples) and switch to the Search tab. Enter "Call" in the search box and open the VI "Call DLL". Run the VI, select any of the examples, and click the "Open Example VI..." button. That shows you how to call a DLL.
Now, given that you have no experience in calling DLLs, have only an "understanding" of C (which to me means you have never written something like a DLL), and don't seem to know that much about what Windows functions you may need, you're going to find this route pretty difficult, especially since you have to deal with Windows API calls, which are not always that easy to do from LabVIEW.
Let me propose an alternate solution. Go over to http://www.autoitscript.com/autoit3/ and download AutoIt. This is an automation tool that allows you to automate just about anything you want. It has an ActiveX interface that you can call from LabVIEW. I've attached an example VI that shows you how to use it to get the value of a text box from one of the tabs in the computer "System Properties" control panel applet.
Attachments:
AutoIt Example (v7).vi 25 KB -
Visual fortran calling a c function in visual studio
Hi,
I am running Windows 8.1 with Visual Studio Prof. 2012. I have installed Visual Fortran also. Now I wanted to make a solution with two projects one for Visual Fortran and one for C, and be able to call a C function from within the Fortran.
Can someone, please, show how to do this step by step? Guide with pictures would be awesome.
Thanks in advance.Hi Engineer101,
One way to integrate your code into TestStand would be to save it as a .dll file. Cick this link for information on how to do this in visual c++ 2008. Once you have the dll, you can call it in teststand using a c/c++ dll action step. I hope this helps, and let me know if you have any further questions!
Al B.
Staff Software Engineer - TestStand
CTA/CLD -
1) Configured Php4.4 to have oci8 enabled with Apache2.2 on Windows 2000 ( service pack4). No error at the time of Apache start but when trying to connect to Oracle using Oracle Instant Client below error is thrown..
"Fatal error: Call to undefined function: ocilogon() in C:\Apache2 \htdocs\star\dbconnect.php on line 7"
Configuration steps..
1) Uncommented "extension=php_oci8.dll" in php.ini to enable oci API's.
2)Configured Oracle Instant client by adding path to Windows path variable as per it documentation.
3)Copied all Php4.4 dlls( oci..etc) into the directory pointed by "PHPIniDir", which is configured in httpd.conf
If i run phpinfo(), i dont see oci8 enabled in the output. I guess there is problem in the configuration? Any insights into the error is greatly appreciated..
BTW, I did same configuartion on Windows XP and is working fine..Also, I dont see path value for path variable in phpinfo() ouput for Oracle Instant Client, which i updated in Windows?
Below is the snippet of ouput from phpinfo().
Apache Environment
Variable Value
HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
HTTP_ACCEPT_LANGUAGE en-us
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
HTTP_HOST localhost
HTTP_CONNECTION Keep-Alive
PATH D:\CESi\isis\bin;D:\CESi\Gateway\mico-win32-bin\;D:\CESi\Gateway\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Support Tools\
SystemRoot C:\WINNT
COMSPEC C:\WINNT\system32\cmd.exe
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
WINDIR C:\WINNT
SERVER_SIGNATURE <address>Apache/2.0.59 (Win32) PHP/4.4.4 Server at localhost Port 80</address>
SERVER_SOFTWARE Apache/2.0.59 (Win32) PHP/4.4.4
SERVER_NAME localhost
SERVER_ADDR 127.0.0.1
SERVER_PORT 80
REMOTE_ADDR 127.0.0.1
DOCUMENT_ROOT C:/Apache2/htdocs
SERVER_ADMIN [email protected]
SCRIPT_FILENAME C:/Apache2/htdocs/info.php
REMOTE_PORT 4977
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING no value
REQUEST_URI /info.php
SCRIPT_NAME /info.php
Environment
Variable Value
ALLUSERSPROFILE C:\Documents and Settings\All Users
CMM_CELL CSTAR_STAR
CommonProgramFiles C:\Program Files\Common Files
COMPUTERNAME STAR-SM-NR-PROD
ComSpec C:\WINNT\system32\cmd.exe
NUMBER_OF_PROCESSORS 2
OS Windows_NT
Os2LibPath C:\WINNT\system32\os2\dll;
Path D:\CESi\isis\bin;D:\CESi\Gateway\mico-win32-bin\;D:\CESi\Gateway\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Support Tools\
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE x86
PROCESSOR_IDENTIFIER x86 Family 6 Model 11 Stepping 1, GenuineIntel
PROCESSOR_LEVEL 6
PROCESSOR_REVISION 0b01
ProgramFiles C:\Program Files
SMS_LOCAL_DIR C:\WINNT
SystemDrive C:
SystemRoot C:\WINNT
TEMP C:\WINNT\TEMP
TMP C:\WINNT\TEMP
USERPROFILE C:\Documents and Settings\xwback
windir C:\WINNT
AP_PARENT_PID 884 -
PHP- Oracle not working- Call to undefined function OCILogon() ERROR
Hi,
I am trying to just do a test program to test php - oracle connection,
My versions are: php5.2.1-Win32 and Oracle 10g
I have made the following settings:
1.) Uncommented the following lines in php.ini:
extension=php_oci8.dll
extension=php_oracle.dll
2.) Set extension_dir = "C:\php-5.2.1-Win32\ext"
Changed the httpd.conf file as: ADDED
1.)LoadModule php5_module C:/php-5.2.1-Win32/php5apache2.dll
2.)PHPIniDir "C:/Program Files/Apache Group/Apache2/conf-"
3.) LoadFile "C:/php/php5ts.dll"
4.)<IfModule php5_module>
<Location />
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
5.) AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
But when I am tryin to run the following program:
<?php
echo "<h1>OCI Test</h1>\n";
$conn=OCILogon("system", "sheetal16", "orcl");
$stmt = OCIParse($conn, "SELECT table_name FROM user_tables ORDER BY table_name");
OCIExecute($stmt, OCI_DEFAULT);
while (OCIFetch($stmt)) {
$table_name = OCIResult($stmt, "TABLE_NAME");
echo "$table_name<br />\n";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>
I am getting the following error:
OCI Test
Fatal error: Call to undefined function OCILogon() in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 3
Please help me to solve this problem.
Thanks,
SheetalSee Re: PHP- Oracle not working- Call to undefined function OCILogon() ERROR
-
Hello all,
I want to call a function located in an external DLL from a PL-SQL block. I execute the followin steps :
1. Create a database library pointing to the external DLL :
create or replace library libstk as 'C:\SUMMIT\libstkdte_s_trade1.dll'
2. Create the definition and the body package :
CREATE OR REPLACE PACKAGE dllcall IS
FUNCTION s_trade (
s_in VARCHAR2 )
RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES(s_trade, WNDS);
end dllcall;
show errors
CREATE OR REPLACE PACKAGE BODY dllcall IS
FUNCTION s_trade (s_in IN VARCHAR2) RETURN VARCHAR2
IS EXTERNAL
NAME "s_trade"
LIBRARY libstk
PARAMETERS (s_in STRING,
RETURN STRING);
END dllcall;
show errors
set serveroutput on
3. Start the PL-SQL block calling the external function. And I got the foolowing error :
1 begin
2 dbms_output.put_line ( dllcall.s_trade ( '<Request> ' ||
3 '<CurveId>MYCURVE</CurveId> ' ||
4 '<Mode>02</Mode> ' ||
5 '<ExpCcy>GBP</ExpCcy> ' ||
6 '<AsOfDate>20001023</AsOfDate> ' ||
7 '<Entity>***SUMMIT-XML***</Entity> ' ||
8 '</Request>') );
9* end;
10
11 /
begin
ERROR à la ligne 1 :
ORA-06520: PL/SQL: Error loading external library
ORA-06522: Unable to load DLL
ORA-06512: at "V31.DLLCALL", line 0
ORA-06512: at line 2
The "Read - Execute permissions" of the DLL file was given to "Authentified users" .
What's wrong ?
TIA
PS : NT2K environment, DB 8.1.7
R. Charles EmileYes, a RPC was set up.
Listner.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Server1)(PORT = 1521))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = NMP)(SERVER = Server1)(PIPE = ORAPIPE))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:\Oracle\Ora81)
(PROGRAM = extproc)
tnsnames.ora
extproc_connection_data =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(CONNECT_DATA = (SID = PLSExtProc))
Thanks
RCE -
Application crashes when calling DLL built with LabVIEW 2011
Hello everybody,
Our application calls DLLs built with LabVIEW 2010 SP1. We installed LabVIEW 2011 and built some DLLs. So far so good. If we start our application and run 2010 DLLs it still works fine. If we run a 2011 DLL just once no error happens, but if we try to run the same 2011 DLL our application crashes reporting the error below. I saved the code for 2010 version and built a DLL and it works fine. Does anyone know why?
Thank you in advance.
#Date: Fr, 16. Sep 2011 16:25:25
#OSName: Microsoft Windows XP Service Pack 3
#OSVers: 5.1
#OSBuild: 2600
#AppName: PasTA
#Version: 11.0f2 32-bit
#AppKind: AppLib
#LabVIEW Base Address: 0x30000000
16.09.2011 16:25:26.181
Crash 0x0: Crash caught by NIER
File Unknown(0) : Crash: Crash caught by NIER
minidump id: 8a779b3f-51d7-4864-8e4d-6ab0195cd158
ExceptionCode: 0xC0000005
N
0x3072C804 - lvrt <unknown> + 0
0x3072CBB8 - lvrt <unknown> + 0
0x7C864191 - KERNEL32 <unknown> + 0
0x7C83AB50 - KERNEL32 <unknown> + 0
0x00000000 - PasTA <unknown> + 0
Attachments:
error.PNG 11 KBOn that note, you should be able to create DLLs in 2010 and run them with 2011, correct?? In my case, I have a 2010 built DLL (talking to sbRIO), most of the functions work when run in 2011, but a couple of them lock up LabVIEW on the desktop (but not the sbRIO), no lock ups happen with 2010 on the desktop.
-
"Hi All,
I have to get data from USB camera, I have following functions in DLL.
DLLINOUT HANDLE WINAPI CC_Open( LPCSTR CameraName , ULONG CameraNumber , CC_CAPTURE_MODE CaptureMode ) ;
and
DLLINOUT BOOL WINAPI CC_CaptureSingle( HANDLE Cam , PVOID Buffer , ULONG TransferSize , CC_TRIGGER_MODE TriggerMode , USHORT TimeOut , OVERLAPPED * pUserOverlapped );
When I open hardware with function cc_open I am getting handle to an object. How can I store this object and pass it to CC_CaptureSingle function?
Another question is when I call CC_CaptureSingle I am getting pointer on the 2 dimension array �PVOID buffer� how can I get this array in Labview?"hi,
you can do this two thing.
1. Create your new DLL with (your DLL will call camera's DLL) one big function my_capture_image() and insert you do CC_Open(), CC_CapruteSingle() and CC_Close(). And to LabView you pass only Array whit image data. And you don't have problems with HANDLE. But you must allocate memory for image array in LabVIEW before you call this DLL!!! [Or use LabVIEW C function for reallocating memory]
2. You must identify type of HANDEL variable. And you can change type of this variabile. But when HANDLE variable is structure it is hard pass this structure to LabVIEW.
If you use LabVIEW 7.1 look example 'Call DLL.vi' it is great!
Have a nice day.
JCC -
"HOW to use Labview call Dll compiled by VC++"
"hello,I use VC++ compile a DLL,and i want to call DLL Function in LABVIEW program.But there is a dll function
when i call it in labview.There is error.The prototype of Dll Function that make error is "USHORT DLLFUN __stdcall IBWRT(unsigned short dev_address,const char *pstrWrite)",The second paramenter is a char pointer,
and the paramenter pass a command which content is
"MEASURE:CURRENTC? 1A,0.001MA".
When i use VC++ to call this function,i program followed:
CString m_wrt;
int ReturnW;
m_wrt="MEASURE:CURRENTC? 1A,0.001MA";
char buffer[40];
strcpy(buffer,m_wrt);
ReturnW=IBWRT(4,buffer);
and this call is correct.
But when i use labview to call this function.ther
e is
error.So, who can help me,to tell me how to call this
function.Thanks."Are you asking about porting code or calling C++ code in LabVIEW? As far as porting code, there's no easy way to move code back and forth between LabVIEW and C++. However, if you are trying to call C++ code in LabVIEW, you can compile it as a DLL and call it in LabVIEW using the Call Library Function node.
Chad B. » National Instruments » ni.com
Maybe you are looking for
-
Problems in instalation/running with JDK 5.0
I'm rellatively new to Java programming. I've had a few classes, know the basic concepts and have tried some tutorials. Recently I installed JDK 5.0 update 6 in my computer (first I tried the Netbeans bundle, but saw it was very complicated and unnec
-
HLEP PLZ full screen makes collerd blocks and is scrmbled
k i really need help i love video sites butt as of a week agio wich i systume restored to and sitll nouting i cant few full screen of anething that uses a flash player ive try so meny diffrint things and no luck can aneyone plz help me when i go full
-
Can't connect to Music Store (Windows or Mac)
I'm unable to connect to the music store from both my windows and mac machines. I get a message saying the Music Store is temporarily unavailble. It's been temporarily unavailable for over 24 hours now. Anybody else having this problem?
-
I am now unable to open I-Tunes on my computer
All of a sudden, whenever I try to open I-Tunes, I get the following message: "The I-tunes application could not be opened. An unknown error occured (-50)" If I try to re-download the program, will all of my stored music be lost?
-
How can i factory restore my imac?
how can i factory restore my imac? i have already done a backup of my files