Can I call a function from a dll in LabVIEW that returns:double*string and int.?
I have a function from a dll that return a double* string and an integer. How can I call this function from LabVIEW? There is a possibility to work in LabVIEW with a double* string?
pcbv wrote:
> Hello all,<br><br>The header of the function is:
>
> "HRESULT WRAPIEnumerateDevices(WRAPI_NDIS_DEVICE **ppDeviceList, long *plItems);"
>
> where WRAPI_NDIS_DEVICE have this form:
>
> typedef struct WRAPI_NDIS_DEVICE<br>{<br>
> WCHAR *pDeviceName;<br>
> WCHAR *pDeviceDescription;<br><br>}
> WRAPI_NDIS_DEVICE;<br><br>
>
> The function is from WRAPI.dll, used for communication with wireless card.
> For my application I need to call in LabVIEW this function.
Two difficulties I can see with this.
First the application seems to allocate the array of references
internally and return a pointer to that array. In that case there must
be another function which then deallocates that array again.
Then you would need to setup the function call to have a pointer to an
int32 number for the deviceList parameter and another pointer to int32
one for the plItems parameter.
Then create another function in your DLL similar to this:
HRESULT WRAPIEnumExtractDevice(WRAPI_NDIS_DEVICE *lpDeviceList, long i,
CHAR lpszDeviceName, LONG lenDeviceName,
CHAR lpszDeviceDesc, LONG lenDeviceDesc)
if (!lpDeviceList)
return ERROR_INV_PARAMETER;
if (lpDeviceList[i].pDeviceName)
WideCharToMultiByte(CP_ACP, 0,
pDeviceList[i].pDeviceName, -1,
lpszDeviceName, lenDeviceName,
NULL, NULL);
if (lpDeviceList[i].pDeviceName)
WideCharToMultiByte(CP_ACP, 0,
pDeviceList[i].pDeviceDescription, -1,
lpszDeviceDesc, lenDeviceDesc,
NULL, NULL);
return NO_ERROR;
Pass the int32 you got from the first parameter of the previous call as
a simple int32 passed by value to this function (and make sure you don't
call this function with a higher index than (plItems - 1) returned from
the first function.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Similar Messages
-
Calling a function from a dll written by using visual studio c++
Hi, how can i call a function from a dll which is written by visual studio c++ in test stand? Although the functions in dll are exported and i've chosen c/c++ adapter, i saw no function in test stand. Is there a different step while i'm calling a function from a dll written by c++ than calling a function from a dll written by cvi?
Hey Sadik,
Selecting the C/C++ DLL Adapter Module should be sufficient for this. When you drag an action step for this onto the Main Step and navigate to the location of the DLL, the function list should populate and you should be able to select the function you want to use. If this is not the case, would you be able to post this DLL so that we can test this on our end?
Regards,
Jackie
DAQ Product Marketing Engineer
National Instruments -
Calling a function from a DLL, exectution in background mode.
Dear Experts,
We have created an ABAP report the calls a function from a DLL file. If the report is executed in on-line mode the program calls and executes the function from the DLL, but if the ABAP programa is executed in background mode it doesnt calls the DLL function.
Do you know a way to solve the problem when executing in background mode?
Best regards.
AntonioHi Gabriel,
Let me explain in details about my DLL function.
We are importing the business partners from legacy system into the SAP CRM system, so at the moment we created the BP master data via BAPI, I get the name of the BP and this moment I call the function in the DLL file. I export the parameter name and I receive back a simplified string with the name reduced to a code. This code I get back from the dll it is insert in a Z table, so there is no interaction in the screen, all must be executed in background mode, because there are a lot of business partners to be converted in SAP system.
I am sending my code for your considerations.
Instancia a DLL
CREATE OBJECT dll 'MTCODE.CPFONET'.
IF sy-subrc NE 0.
RAISE without_dll.
ENDIF.
Move para a tabela interna IT_NAME os valores recebidos na TI_NAME
it_name[] = ti_name[].
Para cada registro importado
LOOP AT it_name.
CLEAR v_string_ret.
wa_matchcode-zregid = it_name-zregid.
wa_matchcode-name1_text = it_name-name1_text.
v_string = it_name-name1_text.
CONDENSE v_string.
TRANSLATE v_string TO UPPER CASE.
CALL METHOD OF dll 'SetNome' EXPORTING #1 = v_string.
CALL METHOD OF dll 'ExecMatch'.
CALL METHOD OF DLL 'GetMCData' = v_string_ret.
FREE OBJECT dll.
Preenche os campos do match-code de acordo com o retorno da DLL
SPLIT v_string_ret
AT '|'
INTO wa_matchcode-zparmcln
wa_matchcode-zparmcfn
v_empty
wa_matchcode-name_first
wa_matchcode-name_last
wa_matchcode-namemiddle.
Adiciona o registro com o match-code correspondente na TE_MATCHCODE
APPEND wa_matchcode TO te_matchcode.
ENDLOOP. -
How can I call a function from a procedure
I have a function named: f_calc_value which return the variable v_result. This function is part of a package.
How can I call this function from a new procedure I am creating?
Thanksor refer this theread....calling function from procedure
-
Calling a function from a dll given by a third party
Hi everyone,
I was given a dll that exposes several COM functions.
I want to call one of them (using java code) that is called LoginGUI() that returns a string.
How could I do that?
Thanks for your feedback.
I am working on a windows environement.Use JNA.
-
Call multiple functions from same dll with call library function
hi,
i am working on a project in wich we need to make a UI to read out a sensor network.
the UI should be usable in any project, but every node needs a different piece of code depending on the type of sensor with wich it is equipt.
so i need to be able to call different pieces of code when i need them, and still be able to use the UI in future projects with possibly new types of node we now don't have.
so someone told me to use DLL's, cause then i would be able to call the code i need the moment i need it.
but i have never worked with DLL's (just learned about this option 3 day's ago) so i have a question.
i know i can dynamicly change the DLL i call with the call library function, but can i dynamicly change the function i call from that DLL ?
or do i have to put a new call library function for each function i want to call, even if its from the same DLL ?
kind regards,
stijnnazarim wrote:
ok so there is no (easy and ubderstandable) way for me to dynamicly change wich function i want to call from a certain DLL.
but now i started wondering, the path on the call library function is not ment to dynamicly change a DLL
but it does work so, if i am carefull, can i use it for that purpose or will labview give me a series of problems once i start using it in larger programs ?
Thepath on the Call Library Node can be used to load a different DLL. Obviously since you can't change the function name your other DLL would have to export exactly the same function name and of course with the same parameters. This is seldom the case so it is not the main use of the path input to the Call Library Node. It's main use is as indicated to load DLLs at runtime rather than at load time of a VI. So that an application can run even when the DLL is missing, until the moment the functionality from that DLL is needed.
If you can make sure that all your DLLs export the same function name with the same parameter you can use the Call Library Node to call into different DLLs through the path input. If however you would need to call different function names you would have to resolve to some DLL which does do the dispatching and invocation using LoadLibrary() and GetProcAddress(). But unless you need to go with DLLs for some reason using the Call By Reference Node can give you an even more flexible approach.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Application with a vi calling a function from kernel32.dll
I have a Labview application which runs very well.
I had add a vi using the functio GetSystemTime from the dll kernel32.dll. The vi calling the API function runs well. Then I tried to buil the application and it does'nt run anymore . A dialog box is opened : "access to a forbidden space memory. I don't understand.
Does anyone have an idea?
Thank you for your response.I have made at test with this function but it runs on my system.
I have used LV 6.0.2 to LV 7.0 on a Win XP Prof. You can compare your solution with mine.
The VI will run once when the application is called. You will see current time.
Waldemar
Waldemar
Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Attachments:
GetSystemTime.zip 23 KB -
HTML/javascript interaction with swf content - can I call swf functions from JS?
Hi,
I've created an AIR application where the
intialWindow.content is a HTML page / JavaScript application. On
this HTML page I want to include some SWF content as a plugin (a
Flex 3 app), so I have an object tag.
From my SWF I can call out to JavaScript using
flash.external.ExternalInterface fine. I can also call methods
within the AIR and Flex APIs via the window or runtime objects.
However, if I try to call methods within my SWF from
JavaScript, nothing happens. Further, I can pass a function
reference from my SWF to JavaScript (via ExternalInterface), and
while I can see a valid function reference in JavaScript, calling
it doesn't call the function within the SWF.
Is this not supported? Or is this something else, like an
applicationDomain issue? My SWF object is loaded via the app:/ uri,
so I didn't think it would be that.I hadn't tried that, and it does work. Thank you. Everyone
should note though that the documentation here
Flex
3 - External Interface
and
Flash
9 - ExternalInterface.html
says:
"Note: Adobe AIR currently does not support the
ExternalInterface class."
which by my reading means that none of this should work,
although it clearly does.
The page
Example:
Using the external API with a web page container was most
helpful in finding the solution, since it mentions referencing the
object id of the plugin (e.g.
window['my-object-id'].functionToCall()) when referencing the
callback function.
This
page has a more concise example. -
How can we call actionscript functions from js
hi
how can we call Action script function from js file . i
tried ExternalInterface. add Callback() .but it throws an error .is
there any other chance to call action script method .thnx in
advanceangadala,
some people have found it is good to include the full
qualification path, ie
if (flash.external.ExternalInterface.available)
flash.external.ExternalInterface.addCallback("ext_method_name",int_method_name);
} // if (flash.external.ExternalInterface.available)
There are also browser differences which affect how you find
the Flex application object which are documented at
http://www.adobe.com/livedocs/flex/3/html/help.html?content=passingarguments_5.html
Richard -
Can I call a "function" from a servlet?
A few of my servlets need to perform about the same computations (have large sections of identical code).
It would save some disk space to be able to call a procedure from different servlets.
Can this be done? How?
Thank you all.A few of my servlets need to perform about the same
computations (have large sections of identical code).
It would save some disk space to be able to call a
procedure from different servlets.
Can this be done? How?This wouldn't be the way to do it.
Since Java is an object oriented programming language, you should use it's concepts to implement a 'basic' class and than extend it. This means: Create a class that contains the basic procedures (you will never create an instance of this class) and then create all the serlvet classes by extending the 'mother' class. Like this you have the common code once in the 'mother' class and the specific code in the specific servlets. -
ADF: Can i call javascript function from java clsss method in ADF?
Hi,
I want to call javascript function in Java class method, is it possible in ADF? , if yes then how?
or I need to use Java 6 feature directely?
Regards,
Deepakprivate void writeJavaScriptToClient(String script)
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
erks.addScript(fctx, script);
}usage
StringBuilder script = new StringBuilder();
script.append( "var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');");
script.append("if(popup != null){"); script.append("popup.show();"); script.append("}");
writeJavaScriptToClient(script.toString());Timo -
Calling oracle function from Access passthrough query does not return list
Thanks to the help I received in an earlier post I've created an oracle 10g function that returns a list after executing the sql it contains. It works in oracle, using sql developer.
I need to have the list that it returns show up in MS Access via a passthrough query. It's not working so far. The connection string etc is ok, I'm able to use passthrough queries to run sql strings successfully. But when I try to call the function via the Access passthrough query at first nothing seems to happen (ie no list appears) and if I try to run it again, there is a odbc error 'call in progress. Current operation canceled'. There are only the three records in the table. I'm missing something, can anyone spot it?
The passthrough query looks like this
select * from fn_testvalues from dual
Again that runs in oracle.
To create the testing table and 2 functions see below.
CREATE TABLE t_values (MyValue varchar2(10));
Table created
INSERT INTO t_values (
SELECT 'Merced' c1 FROM dual UNION ALL
SELECT 'Pixie' FROM dual UNION ALL
SELECT '452' FROM dual);
3 rows inserted
CREATE OR REPLACE FUNCTION fn_isnum(p_val VARCHAR2) RETURN NUMBER IS
n_val NUMBER;
BEGIN
n_val := to_number(p_val);
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
END;
Function created
testing the table:
SELECT val, fn_isnum(MyValue ) isnum
FROM t_values;
VAL ISNUM
Merced 0
Pixie 0
452 1
Now the function that is called in the passthrough query:
create or replace function fn_testvalues
return sys_refcursor is
rc sys_refcursor;
begin
open rc for
Select t_values.*, fn_isnum(MyValue) IsNum from t_values;
return(rc);
end fn_testvalues;lecaro wrote:
OK. But obviously there is some oracle object that one can call via an Access pass-through query which returns rows?Just to clarify. You could fetch data in Access from an Oracle function that returns a ref cursor using VBA editor. To use a pass-through query Oracle function should be a table function or pipelined table function:
CREATE OR REPLACE
TYPE testvalues_obj_type
AS OBJECT(
val varchar2(10),
isnum number
CREATE OR REPLACE
TYPE testvalues_tbl_type
AS TABLE OF testvalues_obj_type
CREATE OR REPLACE
FUNCTION fn_testvalues
RETURN testvalues_tbl_type
PIPELINED
IS
CURSOR testvalues_cur
IS
SELECT testvalues_obj_type(MyValue,fn_isnum(MyValue)) testvalues_obj
FROM t_values;
BEGIN
FOR v_rec IN testvalues_cur LOOP
PIPE ROW(v_rec.testvalues_obj);
END LOOP;
RETURN;
END;
/To test it in Oracle:
SELECT *
FROM TABLE(fn_testvalues)
VAL ISNUM
Merced 0
Pixie 0
452 1
SQL> Now in Access pass-trough query window enter:
SELECT *
FROM TABLE(fn_testvalues);SY. -
How can i call my function from a procedure?
My function is:
create or replace FUNCTION test(pAttributeName IN NUMBER)
RETURN VARCHAR2 IS
ret VARCHAR2(100) := NULL;
VAR n1 NUMBER
BEGIN
SELECT Klartext INTO ret FROM piclist WHERE ATTRIBUTNAME = 'voltage_level' and PICLIST_ID =pAttributeName;
RETURN ret;
Insert into BM_ATTRIB(ID_ERFASSUNG,ID_ATTRIBNAME,ATTRIB_CHA,BM_ATTRIB_ID) VALUES(1,1,ret,1);
exception
when no_data_found then
ret := 'AAA' ------- you can return any default value,if you like
--return ret;
return NULL;
when others then
dbms_output.put_line('Exception:'||sqlerrm);
End;
I want to call it from a procedure!
Please help!
Nicoleif the function is in the same package as the procedure then merely specify the function name and parameters:
retcode := functionname(param1..paramn);
If in another package then:
retcode := packagename.functionname(param1..paramn);
If the function is in another schema then you need to grant execute rights to the package/function to the schema trying to run the function:
grant execute on packagename/functionname to otherschema;
you need to be the package/function schema owner to do the above grant. -
Can LabVIEW call a function from a .sys file or is LabVIEW limited to dll access?
My vendor has sent me a .sys file with functions accessing their hardware. Can i call these function from labview directly or do I have to wrapper the .sys with a dll?
Well a sys file is a kernel device driver. LabVIEW does not have any direct way of accessing such a driver. The way kernel drivers are accessed is usually through a DLL which makes calls to WinAPI functions such as CreateFile(), ReadFile(), WriteFile(), CloseHandle() and DeviceIORequest(). Since these WinAPI calls are basically just DLL calls too, you could theoretically use the Call Library Node to call them and access the kernel device driver in such a way.
However for any kernel device driver with more than one or two device driver calls, it will certainly be easier in terms of development, debugging and maintenance of the code, to write actually a dedicated DLL in C/C++ for this device driver and access that DLL from LabVIEW, especially if you consider the LabVIEW datatype limitations when designing the DLL interface (Basically this same DLL can then be called from any other Windows development environment, be it Visual Basic (similar datatype limitation as LabVIEW), Delphi, (Visual) C, LabVIEW or also various scripting environments like Python and Lua.
Some of the necessary WindAPI calls are rather involved and pose quite a bit of trouble to get the parameter data right in LabVIEw.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
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
Maybe you are looking for
-
Error while creating a Quotation in dp81 with simulation
hi Guys, My client has a simulation for an operative project. First a quotation was created through sales pricing in dp81. its rejected. now he wants to create another quotation with simulation. when the inputs are given its gives error as " The refe
-
No option to set tv signal in video
Trying to connect ipad2 to tv but there's no tv options in video setup in settings. The only thing I've got there is captioning and start playing. Please help!!
-
[iOS][Your Music] Album sort by artist is out of order
After the 3.4.0.684 update for IOS, the album sort by artist is out of order. It looks like the sort is only factoring in the first letter in the sort as seen below. Can the old sort methodology be put back in.
-
11.1.0 install on RHEL 5
I have two questions. First how in the world do you uninstall the 11.1.0 agent on RHEL 5? I was in the middle of installing and lost all connectivity so I thought the error i was getting was from it not finishing the install... So I basically ended u
-
Transient Entity Attribute as an Assoc
Can I use a transient Entity attribute as an Assoc? I created an Attribute at the Entity level that is not mapped to a table. The entity is called FirstEndEntity. Then I created an Association between FirstEndEntity and OtherEndEntity. I used the att