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,
stijn
nazarim 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
Similar Messages
-
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. -
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 -
Hi all,
I would like to work with a LabVIEW program that I did not programm by myself.
In this programm an external DLL needs to be called. in the Momente this dll ist called with the "Call Library Dunction Node" LabVIEW crashes with this Error Message:
DAbort 0x37C03D in MemoryManager.cpp
Attached is the entire Log.
The programm runs on the computer of the original programer.
I have never handeled with DLLs or something like that before, so I have absolutely no idea how to rsolve this problem.
Thanks for your help!
Attachments:
lvlog.txt 2 KBA DLL can be compiled by different compilers. By "generic" C DLL, i refer to ANSI C (so no C++, no Borland C or something else).
My question is raised as parameters, esp. arrays and strings, can lead to this behavior when used in the wrong way (including "Calling Convention").
Also, interfacing with the LV memory manager can lead to crashes like this, but this wouldn't be a "generic" DLL as it binds to LV (due to LV API calls).
Without a better knowledge on the DLL and its functions, there is not much we can help you with.
Where does the DLL come from?
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
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 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 -
Can we call multiple Smartforms from single Driver Prog?
Hi all,
Can we call multiple smartforms from single Driver Program. Here Driver program is custom Program.
I want to give Print Parameter only once and output should get printed one after the another smartform in same order of smarforms were called.
If yes, then how?
Thanks in advance.Yes, you can do this in your Smartform driver program.
Each time you call you Smartform function module you will need to change the values in structure OUTPUT_OPTIONS slightly.
On the first call set TDNEWID to X.
After this, set it to space
On the last form set TDFINAL to X.
This will put all of the output into one spool request, in the order they are called in the program.
Regards,
Nick -
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! -
Call multiple screens from LSMw
Hi
i want to call multiple screens from lsmw
I need to call a three transaction from LSMW wich are subzequent steps for data entry.
1) first tcode to be called is eprodcust which creates some master data and using this master data and some fields of data creatd i need to call two more tcodes first iq01 to create meter and save then eg31 tcod to feed data.
Please suggest where in lsmw can i give options for suc hscnerio and call of subsequent screens.
regards
Edited by: Prieti_V on Nov 8, 2011 8:28 PMHi Priti ,
we have few options to handle such cases , to avoid Locked Problems what you can do is
-->write BDC program within LSMW to create installation ( this will be created within step of 11 Convert Data ).
-->Based on the above BDC results ,run another BDC within LSMW to create Device.( this will be created within step of 11 Convert Data ).
-->third BDC records , let SAP do it thru LSMW or can you do it convert data step itself.
this approch needs lots of codes , so in worst case and if you dont want to break the loadings the follow this.
*Better to find any BAPI which will do creation of installation ,devices
regards
Prabhu -
Call native methods from windows dll
Hello all,
I want to call BlockInput method from User32.dll. My source code looks something like this:
public class User32Dll_1 {
static {
try {
System.loadLibrary("User32");
catch (Exception ex)
ex.printStackTrace();
public static void main(String[] args) throws UnsatisfiedLinkError {
BlockInput (true);
/** @param b
* @dll.import("USER32")*/
private static native boolean BlockInput(boolean bBOOL);
And the problem is that I get the following exception:
java.lang.UnsatisfiedLinkError: BlockInput
at User32Dll_1.BlockInput(Native Method)
at User32Dll_1.main(User32Dll_1.java:27)
Exception in thread "main"
Can someone provide me a solution for this?
Thank you in advance!can't do
use JACOB
http://danadler.com/jacob/
or
http://www.ezjcom.com/ -
Hello friends,
I was wondering if anyone could help me with the following issue:
I need to call a WS from a JSP with SSO.
Does anyone have something like source code or turorial ?
PS: The WS I need to call is already consumed from Java WD using Logical Destination.
Any help will be welcome.
Thanx,
Best Regards,
RamatíI'm trying to call a bpel process and I get an error in the responseThere is BPEL. That might be a better place to ask this question. If you do go there be sure to tell them what error message/number you get.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Using PostLVUserEvent function from Labview.dll
I am trying to use the PostLVuserEvent function from the labview.dll and corresponding extcode.h file. I have made my own dll using CVI that uses this function. I then use Labview to call my dll. My dll compiles fine. No issues, no errors. LabView can call my dll function containing the PostLVUserEvent function with no errors. However, the event number LabView passes my dll is not the same event number I receive so no LabView event is triggered.
Has anyone had this issue?
We are trying to solve it from the LabView side and the CVI side but cannot seem to get it to work. The examplesI have found here were compiled using C++ and those seem to work. I do not know why when I compile my program in C, it creates the dll but does not work. If I had to guess, i think it's an issue with pointers vs non-pointers. When the LAbview program selects my function from the dll, it shows the argument PostLVUserEvent as a pointer when in my dll, it is not a pointer PostLVUserEvent....
Any ideas?
Thanks in advance.Hello Blue
Take a look to this one, it was created on C, I think the .c and the .h files will give a good idea, how the function should be implemented. It is important when calling the dll on LabVIEW, to use the std calling convention and run it on the UI thread.
Regards
Mart G
Attachments:
LabView EventTest.zip 1041 KB -
Running multiple instances from same oracle home
Hi Gurus,
I am preparing for OCA 11g examination. I had a question about running multiple instances from same oracle home. While reading the book I came across a statement about database control which says "If there are several database instances running off the same Oracle home, then each will have its own Database Control instance".
Now I assume that this statement implies multiple instances accessing the same physical database (which as per my knowledge can happen only in case of a RAC).
I am not able to understand how exactly can you have multiple database instances in a single oracle home. I have installed Oracle 11g on my computer whose oracle home is +"D:\oracle\product\10.2.0\db_1"+; now this directory houses all the binaries (executables and folders like admin,bin, etc) for the oracle instance that I have installed (the instance name is ocp1). Now if I am to install or create another Oracle Instance (say ocp2) in the same home, wont there be a conflict of binaries of the two instances in the same home ?
Basically,it makes sense if db_1 folder is further split into multiple folders, one for each instance (for example, one for ocp1 & one for ocp2); each of these folders will then contain the binary files, libraries,etc for its own instance; but, this is not the case, here db_1 houses all the binaries directly under it ...
The other question which stems from the statement I mentioned above is that if having multiple instances running from same oracle home accessing the same physical database, can this arrangement be called RAC at all; or does RAC dictate that you cannot have multiple instances that are accessing the same database have to be installed on physically separate machines and so you cannot have two RAC instances (accessing same physical database) installed on the same computer ??
I hope my questions are not too much confusing ... !!
Cheers,
SudriptaHello,
"If there are several database instances running off the same Oracle home, then each will have its own Database Control instance".This is true, and also means each instance will have its separate database (i.e. dbf files etc.) & separate DB Control. Usually in this case you create several instances on the same node.
Now I assume that this statement implies multiple instances accessing the same physical database (which as per my knowledge can happen only in case of a RAC).You are correct about RAC where several instances (usually running on separate nodes) access the RAC.
More info:
1 Oracle Home - 1 Database - 1 SID is possible.
1 Oracle Home - Many Databases - Many SID is possible.
1 Oracle HOme - 1 Database - Multiple SID is possible and this is called RAC. -
Creating Dll with Vision Library
Greetings Board Members,
I have a small Application For which i want to make a shared DLL and test them before deploying at other co worker computer, The application uses the Labview Vision, The DLL are made by Building the DLL.
When I use the same dll and call them with labview i get an error code while the VI Modules with which DLL are made are used instead of DLL they are running OK. Can some one throw light on this issue and how it can be solved. The application is simple, Initialze USB Grabber, Snap and save image, Close Grabber. I am getting Error code in snap and save image.
Regards
Harjeet1.What is the error number or describtion you get?
2.Do you know that you will need to have a vision runtime license ($) at the other computers where you want to run the dll?
Christian -
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
Maybe you are looking for
-
Records does not show up for TOP N
hello...i have a variable with a TOP 4 condition in the query, when i run the report with the selection of date input with the variable range of 1 year, i cannot view the data for that report, i checked the cube that there are data in the cube, but w
-
Sony DSR-45A? Possible for NTSC Monitor Playback from Quicktime?
Title says it all. We have a new Mac Pro with two 22" monitors using both of the graphic car DVI ports. However with have this beatiful 60 inch monitor next to us that we would like to hook it up to. The monitor has BNC Component connections, VGA con
-
How do I play content on amazon instant video from my iPad on my hd tv
HOw do I play content from amazon instant video, etc., from my iPad to hd tv
-
I can use my program, such as Final Cut, on a borrowed macbook
I´m a happy I Mac user, and works with final Cut and Logic, now i´m attending a course in both programs, and a friend has been so kind, and lend me he's macbook pro but ....... how do i use my programs on he´s computer ??
-
When importing from a camcorder getting pixelised footage and crackly sound
Hi, Hope you can help. I have recently installed a new program which may have affected iMovie. I dont know this for sure, but iMovie was working recently and now its not importing properly. When I click on Import is makes a high pitch crackly sound a