Pointer to a function (C .dll files)

Hi,
We have a .c dll file that we are trying to use in Labview to talk to a USB transceiver. What happens is that when we try to configure the device we call c functions using the "call library function node" utility in Labview i.e. void open_channel(char channel_number) etc.
At the start of the code, we need to send the .dll this function:
void AssignResponseFunction(RESPONSE_FUNC pfResponse, UCHAR *pucResponseBuffer); where RESPONSE_FUNC is a pointer to the function that will be called whenever a response / event message is received from the module.
When the USB device has a message that it wants to make available to us, it uses the pointer pfResponse to call a function in memory that will process the data that has been stored in pucResponseBuffer and make it available. Is this possible in Labview and how would I even go about doing such a thing?
Ken

hi,
first of all, thanx for the advice.
i tried to write the dll, that passes the procaddress to the funtion that needs it. i made a dll with the appbuilder that matches the prototype of the callbackfunctio (expet that the returnvalue isnt bool but an uint).
the next thing i have done is to write a dll in visual c++. as i am no programmer at all, i tried to get this done with some books and the internet, but i fail.
i wrote following code:
#include "stdafx.h"
#include <windows.h>
HINSTANCE h = 0;
const char* lib ="MeineDLL.dll";
const char* proc="DLL Funktion";
extern "C" __declspec(dllexport) int myDLLload(LPCWSTR lib)
if(h == 0)
LPCWSTR lib = libinput;
h = LoadLibrary(lib);
return 0; // ok
return 1; // error
// übergib addr in LabView der anderen DLL-Funktion
extern "C" __declspec(dllexport) int myDLLgetprocaddr(LPCSTR proc, int* addr)
if(h != 0)
*addr = (int)GetProcAddress(h, proc);
return *addr != 0; // ok
return 1; // error
extern "C" __declspec(dllexport) void myDLLFree()
FreeLibrary(h);
the problem is, that the myDLLload function returns 0 all the time, no mather how i define "lib". and i think that is the reason why the myDLLgetprocaddress funktion fails to deliver me the address...
i know that you surely know much more about visual c++ than i do, so i would be very thankfull for any advice how i can solve this problem.
thank you a lot
martin

Similar Messages

  • How to use function in dll file

    hi
    i am new to jni. i want use the function declared in the dll function. i am also having the .h header file.
    can anybody please help me out with this?
    thank you
    suhas

    What kind of function? Function with name created
    with javah generated name or arbitrary function? In
    first case load library and just use "function()", in
    second case you should call something like "rundll"
    under Windows or create wrapper to call from Java and
    redirect call to DLL function itself.Thanks for the reply Michel,
    Actually I have connected RFID 6500 module to PC through com port. and want send request for which module gives response.
    The commands for the module are declared in FeCom.dll and also in FeCom.h. The definitions of the functions are given in FeComDef.h.
    Now I get problem while accessing function in these files.
    did you get the problem?
    waiting for reply
    Thank you,
    suhas

  • How to call a function in DLL file, while writing test scripts in ATML standards

    Hello all,
                I am trying to develop test scripts in ATML standards. I need to call a function in DMM.dll file. How can i do that in ATML standards, please explain with some example ATML standard XML file. Someone please help me in doing so. Thanks a lot in advance.
    With Regards,
    kalyan

    Hi srivinayaka,
                         I am attaching the XML file i have written in ATML standards and the Labwindows/CVI code that was generated when the XML file is opened in TESTSAND. actually the defenition of the function "IALdcpwr_reset()" is in IALdcpwr.lib and IALdcpwr.h files.
    "How can we add this library and header files?" so that i can show the path of definition. whether it should be done manually or can we do some changes in the XML file and make the work done?. Thanks in advance. If you have any example for this type of sequences. please forward me which would be helpful for me.
    With best regards,
    kalyan
    Attachments:
    XMLfile.doc ‏135 KB
    XMLfile.doc ‏135 KB

  • Call function from C++ (dll file) in Flex

    Hi,
    i using Adobe Flash Builder with Flex 4 , i write a C++ Code in dll File , i need to access to my Function in dll file in Flex ?? what should i do ??

    Lets make sure you are performing the correct actions:
    1.  Place a Call Library Function node on your block diagram.
    2.  Double click the node to open up the Call Library Function dialog box.
    3.  Click the Browse button and navigate to the DLL function.  Select the proper DLL and click Open, or just double click on DLL.
    4.  On the Function Name box, click on down arrow.  A list of functions found in the DLL should be displayed.  Choose the function.
    5.  On the Calling Conventions box, click on down arrow and select C or WINAPI.  In your case, it should probably be C.
    6.  The Parameter box should show return type.  In the Type box, select the data type of the return value.  Since you won't see HRESULT here, you need to find out what data type HRESULT is in the C code.  I would guess it is a numeric so select numeric from the drop down list.
    7.  Click the Add a Parameter After button.
    8.  In the Parameter box, change the name arg1 to the actual name of your first parameter, which is byPortNumber.
    9.  In the Type box, choose Numeric, since a BYTE is a numeric in Labview.
    10. In the Data Type box, choose Unsigned 8-bit Integer, since a BYTE is a U8 in Labview.
    11. In the Pass box, choose Value.  If the C parameter was a pointer (*BYTE), you would choose Pointer to Value.
    12. Verify that the contents of the Function Prototype box contains the correct syntax according to the C declaration.
             C:  HRESULT RSPInitComm (BYTE byPortNumber)   should be in Labview: long RSPInitComm(Unsigned char byPortNumber)
    13. Click OK button.
    Try it out.
    If you get a crash, change the Calling Convention to WINAPI.
    - tbob
    Inventor of the WORM Global

  • How to call functions defined and packed in a .dll file

    hi,
    my client have provided me with a .dll file which implements all functions tasks.
    earlier we created a applications in vb that accessed functions from the .dll file provided by client.
    now he wants java implementation of the same application written in vb.
    now how to access functions in .dll file provided by the client from java source code.
    regards,
    s.mohamed asif

    For this you should write JNI wrappers for the native functions, that is you create class with the native function prototypes as native methods, implement these methods with native functions in JNI module, each JNI function calls a native function from your DLL.
    I know that JNI coding is a greate pain. That is why I am developing Java Platform Invoke which is a paradigm of .NET Platform Invoke. See my demo at
    http://www.sharewareplaza.com/Java-Platform-Invoke-API-Demo-version-download_49212.html

  • How to access Call Back Functions using *.dll in the Labview?

    Hai,
    I am Pavan Ram Kumar Somu.
    I am new to Labview, currently I am working on MVB Interface.
    I need to access the API functions from *.dll file in Labview, as of now , I am doing this with Call function Library node in Labview but it does not support the following data types like
        1. Pointer Arguments(To which memory it points in Labview)
        2. function pointers Arguments
        3 .pointers in structures and pointer structures in structures and many other data types.
    Please Answer the below queries also:
    1. How to pass pointer arguments to API functions in DLL and how to collect pointer  
        return types from API functions in DLL
    2. How to pass structure arguments to API functions in DLL and how to collect structure
        return types from API functions in DLL
    3. How to use callback functions(nothing but function pointers) in Labview and how to
        collect callback fuctions return types from API functions in DLL
    I need your help while passing these datatypes to API functions in DLL from labview.
    Suggest me if there is any other alternative for implementing this task.
    I am referencing some examples here:
    Examples:
    I)
    Unsigned short int gf_open_device(void *p_device_config, unsigned long int client_life_sign_timeout, unsigned short int *device_error)
    void *p_device_config: How to access/pass these arguments in LabView and to which memory location it points in LabView.
    II) #include <windows.h>
         #include <process.h>
         HANDLE rcvEvent0, rcvEvent1;
    /* Function call*/
    CanGetReceiveEvent(handle[0], &rcvEvent0);
    Above is a piece of C code, Now I want to use HANDLE datatype which is windows based, how to use these type in the LABVIEW.
    With regards
    Pavan Ramu Samu

    "Somu" <[email protected]> wrote in message news:[email protected]...
    Hai,
    I am Pavan Ram Kumar Somu.
    &nbsp;
    I am new to Labview, currently I am working on MVB Interface.
    &nbsp;
    I need to access the API functions from *.dll file in Labview, as of now , I am doing this with Call function Library node in Labview but it does not support the following data types like
    &nbsp;&nbsp;&nbsp; 1. Pointer Arguments(To which memory it points in Labview)
    &nbsp;&nbsp;&nbsp; 2. function pointers Arguments
    &nbsp;&nbsp;&nbsp; 3 .pointers in structures and pointer structures in structures and many other data types.
    &nbsp;
    Please Answer the below queries also:
    &nbsp;
    1. How to pass pointer arguments to API functions in DLL and how to collect pointer&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp; return types from API functions in DLL
    &nbsp;
    2. How to pass structure arguments to API functions in DLL and how to collect structure
    &nbsp;&nbsp;&nbsp; return types from API functions in DLL
    &nbsp;
    3. How to use callback functions(nothing but function pointers) in Labview and how to
    &nbsp;&nbsp;&nbsp; collect callback fuctions return types from API functions in DLL
    &nbsp;
    I need your help while passing these datatypes to API functions in DLL from labview.
    &nbsp;
    Suggest me if there is any other alternative for implementing this task.
    &nbsp;
    &nbsp;
    I am referencing some examples here:
    Examples:
    I)
    Unsigned short int gf_open_device(void *p_device_config, unsigned long int client_life_sign_timeout, unsigned short int *device_error)
    &nbsp;
    void *p_device_config: How to access/pass these arguments in LabView and to which memory location it points in LabView.
    &nbsp;
    II) #include &lt;windows.h&gt;
    &nbsp;&nbsp;&nbsp;&nbsp; #include &lt;process.h&gt;
    &nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp; HANDLE rcvEvent0, rcvEvent1;
    &nbsp;
    /* Function call*/
    CanGetReceiveEvent(handle[0], &amp;rcvEvent0);
    &nbsp;
    Above is a piece of C code, Now I want to use HANDLE datatype which is windows based, how to use these type in the LABVIEW.
    &nbsp;
    With regardsPavan Ramu Samu
    Search the forum (forums.ni.com) for callback, pointer or handle, and you'll find that it is all possible, but not very easy.
    e.g.: http://forums.ni.com/ni/board/message?board.id=170&message.id=88974&requireLogin=False
    Regards,
    Wiebe.

  • Using call library function on a dll file created in an old version of labview

    So I'm trying to update an old labview program to work in labview 2012. Everything converted over just fine but labview will always crashoverwrote some while using a  library function in a DLL that was compiled using labview 8.5. Labview exits, stating that it vital memory area. It passes an array of data to the library call and an empty array for output. I thought I could get around this problem by changing my code to initialize the array being passed in so that it would be large enough to hold all the expected output. Now instead of overwritting areas of memory it shouldn't, I get a pop up message that says:
    fatal internal error
    memorymanager.cpp line 406
    8.5.1.f5 
    So it appears because I don't have the ability to recompile the DLL file it runs off of the 8.5 runtime instead of the more recent one. Is there any thing I can do about this?

    rjpierce wrote:
    So I've been trying to figure out a way around this on my own while waiting on a response. From what I'm reading, a dll created in one version of the labview runtime can't be used by a different labview runtime. Am I correct in this? I feel like I must be mistaken since that's basically the opposite of how a dll should work. If nothing else works I have access to the original code for the DLL but it requires the control and simulation toolkit. I would like to avoid having to recompile the DLL since it was put in to a DLL to avoid the need for the toolkit to begin with. 
    Your problem most likely is that you try to pass native datatypes to the DLL function? That only can work if the caller and callee use the same LabVIEW runtime engine. Otherwise the memory block created in the memory manager of the caller will be accessed by the memory manager in the callee and bad things happen. Instead you should define the DLL function to use standard C datatypes (Pointer to C array) and also make sure to allocate the according buffer in the caller for all output array parameters.
    An even more elegant way would be to completely abandon the DLL approach and call the according functions directly in LabVIEW. Then you won't have the problems about mismatched runtime engines. Passing C array pointers to a DLL is less performant than passing native datatypes, but if you use native datatypes you have to make sure the DLL is compiled in the same LabVIEW version as the one you call it from.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to call function in included dll file through java application.

    Hi All,
    i am trying to create an java application which call c# functions using JNI. i am completed with the code and it is running fine when i tried to run from netbeans IDE. But when i tried from Calculator.jar file, first time it throws this error:
    F:\JavaProjects\Calculator\dist>Java -jar Calculator.jar
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no CSharpClient in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at calculator.CalculatorApp.<clinit>(CalculatorApp.java:20)
    After that i included that dll file in the cuurent directory. And compiled and tried to run, it throws an unexpected error:
    F:\JavaProjects\Calculator\dist>Java -jar Calculator.jar
    *# An unexpected error has been detected by Java Runtime Environment:*
    *# Internal Error (0xe0434f4d), pid=2640, tid=3700*
    *# Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode, sharing)*
    *# Problematic frame:*
    *# C [kernel32.dll+0x12a5b]*
    *# An error report file with more information is saved as hs_err_pid2640.log*
    *# If you would like to submit a bug report, please visit:*
    *# http://java.sun.com/webapps/bugreport/crash.jsp*
    Anyone have idea how to solve this error.
    Thanks in advance.

    This error is created whenever things go sour on the native side. The first thing you can try, and I assume you are using a Java<->C++<->C# bridge which includes two dlls, one created by C++ and another by C#. Is to make sure that the C# dll is compiled using /t:module switch during compilation.
    If you are using VS2008, or VS2005, you can add a post build syntax like:
    csc /t:module /out:"$(ProjectDir)$(OutDir)YourModule.dll" "$(ProjectDir)YourCSfile.cs"
    Hope this helps! If not, ensure first that the native code works by creating a native test app for it.

  • How to apply dll file or user defined function in B1

    Dear all,
    I have dll file and user defined function which use for converting number amount to text of my language. I plan to create UDF to keep the result of function on A/R invoice and I will use this UDF on print layout desiner but I don't know how to apply my function on B1. Please kindly suggest.
    Thanks you in advanced.
    Angnam

    Hi Angnam,
    Check this link.
    Re: amount in words
    Thanks,
    Srujal Patel

  • Can i use DLL file created by Fortran with the call libary function node

    Can i use a DLL created by Fortran (Compaq Visual Fortran) with the call library function node in labview. If yes how do i create the DLL file if i have the Fortran code.
    Thanks

    Yes! Maybe these old post will help:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=88786
    http://forums.ni.com/ni/board/message?board.id=170&message.id=109150
    Good luck!
    Message Edited by altenbach on 03-21-2006 02:35 PM
    LabVIEW Champion . Do more with less code and in less time .

  • How can I using functions implicit in dll file in java code ?

    How can I using functions implicit in dll file in java code ?
    I'm developing a program that interfacing with fingerprint hardware.
    I have the finger print already, and I have to the SDK that have all functions for managing this fingerprint.
    These SDK functions are represented in dll files.
    I want to know how can I use these functions in java code .
    I looked on this link of sun forums :
    http://forum.java.sun.com/thread.jspa?threadID=305171&messageID=1215613
    but I don't Understand the meaning of native code.
    Thanks for help.

    please please please please please please please please help me:
    After reading a lot of articles, tutorials, and overviews about JNI (Java Native Interface)
    I found that these steps
    1.     Develop the Java code
    2.     Compile the Java code to a class file
    3.     Generate the header file
    4.     Implement the native method
    5.     Create the shared library or DLL
    6.     Run the Java program
    Is the common steps in JNI development
    The most powerful link was
    http://java.sun.com/docs/books/jni/html/start.html
    and
    http://www.netbeans.org/kb/55/beginning-jni-part2.html
    and the pdf oh this link
    http://www.ibm.com/developerworks/edu/j-dw-javajni-i.html requiring IBM registration to download it.
    But I have already the DLL, and want to the stright forward way to use its functions by java code only.
    I don not to write any C++ code .
    Is this possible???????????????????????????????
    The name of these dll is �zkemsdk.dll�
    It developed by ZKSOFTWARE company for managing a finger print �NP1500A�of
    http://www.napcogulfsecurity.com/finger_print.asp
    thanks for help

  • Where is the DLL file that exports these functions?

    I have been tasked with controlling a DAQCard E-series via program written in C. My development environment is MinGW on Windows 2000, with DAQ-MX and Traditional installed.
    I started by using the MX example code as a foundation. Everything goes well it comes time to link the code; the linker can't find the exports defined anywhere.
    E.g.: WriteDigPort_Fn.o : undefined reference to 'DAQmxCreateTask@8'
    WriteDigPort_Fn.o : undefined reference to 'DAQmxCreateD0Chan@16'
    etc.
    (Same with the Traditional example, since it's using the same NIDAQmx.h header file)
    My guess is these are properly defined in the (MSVC) .lib file supplied, but MinGW doesn't like it. I can build a definition file for this DLL that Min
    GW will like, but to do this I need to know, what is the name of the DLL file these functions actually are exported from?
    PS: Not part of my question, but for everyone searching here for info on NI DAQ + MinGW: MinGW defines 64-bit integer types using 'long long' instead of 'int64'. If you're getting errors referring to int64/etc., change the following lines in NIDAQmx.h:
    //typedef __int64 int64; // replace this
    typedef long long int64; // with this
    //typedef unsigned __int64 uInt64; // and this
    typedef unsigned long long uInt64; // with this

    Greetings,
    The NI-DAQmx ANSI C functions are contained within nicaiu.dll. This DLL should be available in the following location:
    C:\WINDOWS\system32
    Good luck with your application.
    Spencer S.

  • Dynamically changing the name of the .dll file to load in call Library

    Our current model is to use dll files as "plug-in" modules for instruments and a top layer test step calls the appropriate driver dll.
    For instance
    the TestStep is called with the kenmore.dll passed as a parameter so the kenmore.dll file is loaded, the functions are registered and the functions are called.  Next the TestStep is called with whirlpool.dll as a parameter now the whirlpool.dll is loaded the functions are registered and the functions are called.  This works very well in our current CVI/LabWindows environment.  Now we plan to work with LabView, we wish to retain this model (as DLL files, there are advantages in our model for us).  We have not found a way to load these dll files from LabView without hard coding the path and filenames in.
    Any suggestions on how to dynamically change the path in the Call Library module, or another suggested method of loading the dll via LabView?
    Thanks,

    John Stuart wrote:
    Our current model is to
    use dll files as "plug-in" modules for instruments and a top layer test
    step calls the appropriate driver dll.
    For instance
    the TestStep is called with the kenmore.dll passed as
    a parameter so the kenmore.dll file is loaded, the functions are
    registered and the functions are called.  Next the TestStep is
    called with whirlpool.dll as a parameter now the whirlpool.dll is
    loaded the functions are registered and the functions are called. 
    This works very well in our current CVI/LabWindows environment. 
    Now we plan to work with LabView, we wish to retain this model (as DLL
    files, there are advantages in our model for us).  We have not
    found a way to load these dll files from LabView without hard coding
    the path and filenames in.
    Any suggestions on how to dynamically change the path in the Call
    Library module, or another suggested method of loading the dll via
    LabView?
    Thanks,
    As Ben has pointed out LabVIEW
    scripting may be a possibility but you are going with that in highly
    unsupported area. Also I happen to know that changing the library name
    of a Call Library Node through scripting has produced unsupported
    feature errors previous to LabVIEW 7.1 eventhough the method was there.
    And LabVIEW 8 hides the whole scripting business behind the license
    manager.
    Another approach at least if the different DLLs do not change to often
    thier functions and parameters would be to create a wrapper DLL. Have
    it a method that loads the desired DLL and links its functions to
    internal function pointers. Then when calling the actual function entry
    points just redirect directly to the correct fucntion through that
    function pointer. Since you are already working in CVI creating such a
    DLL should be only a matter of taking out a little bit of your already
    existing code and put it into a DLL project.
    Rolf Kalbermatter
    Message Edited by rolfk on 04-12-2006 07:40 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Accessing DLL files from Java

    I have a problem with Java, and the problem is that I'm trying to call a DLL file declared by C++ only but without a support for Java programs, is what I'm aiming for going to be available by using the rundll32.exe file.
    Note: I'm trying to use the (skydll.dll) file for controling skystar2 DVB card.
    Message was edited by:
    JZoro

    You cannot directly call a DLL from Java unless the DLL exposes entry points that are compatible with the JNI calling conventions.
    For example a Java class calling a native function like below:
    class Arguments
       private native void setArgs (String[] javaArgs);
       public static void main (String args[])
          Arguments A = new Arguments();
          newArgs[] = A.setArgs(args);
       static
          System.loadLibrary("MyArgs");
    }Needs a DLL entry point with the following signature:
    JNIEXPORT void JNICALL
    Java_Arguments_setArgs (JNIEnv *jenv, jobject job, jobjectArray oarr) {Notice that the first parameter of the method is of type JNIEnv and the second can be either a reference to a class or Java object instance.
    Jacques Gonzalez
    J4SOFT

  • The user function manager DLL (ufmanager.dll) could not be found.

    Hi Everyone,
    I just spent two horrible days getting a Windows 2003 server to run our .net 2008 asp Crystal report.  It was all because of the unknown.rpt error.  The final answer was to give the NETWORK SERVICE account full control to the C:\ and then remove that permission. 
    Now, I'm up to my next challenge:
    Error in File C:\WINDOWS\TEMP\CrystalReport {2A76C903-674A-4A7B-AA04-44FC7E206C3F}.rpt:
    The user function manager DLL (ufmanager.dll) could not be found.
    That dll is there on the server.  What should I do?
    Please help!!!!
    Thanks,
    Ed

    Ok, here is where the fun begins as the issue you are getting is not something I've run into before. A few clarifications and suggestions re. troubleshooting.
    I used the latest runtime.msi
    - confirm this was CRRedist2008_x86.msi (just want to be sure)
    pdf about the unknown.rpt.
    - do you have a link or name of the pdf?
    To troubleshoot let's do this:
    1) Download the depends utility. I want to see if there is a missing dependency. depends is here:
    http://www.dependencywalker.com/
    open the ufmanager.dll in depends and see what it reports.
    2) Run Process Monitor utility. ProcMon can be downloaded from here:
    http://technet.microsoft.com/en-ca/sysinternals/bb896645.aspx
    Make sure you filter ProcMon for your process as this will shrink the log file. Then look for ufmanager.dll and see where the app is trying to load it from.
    3) Check this registry entry:
    HKLM\software\business objects\10.5\crystal reports
    See that CommonFiles is pointing to c:\program files\business objects\common\2.8\bin.
    4) Copy the ufmanager.dll from c:\program files\business objects\common\2.8\bin to your app directory (this is just a test as I want to see if we can load the dll from anywhere...)
    Ludek

Maybe you are looking for

  • How do i install cc photoshop touch onto my tablet

    i just purchased a surface rt and i want to install cc photoshop touch onto it (i already own creative cloud) and when i sign in to creative cloud and try to download PS for andriod it just brings me to the store to purchase photoshop touch even thou

  • Invoice vs. Money Request as Goods - same protection for Buyer and Seller?

    Please help settle a long-standing dispute:  A Buyer is purchasing an Eligible Item (otherwise eligible for PayPal protection) from a Seller.  All 3 methods listed below are valid methods to make payment and do not affect eligibility under PayPal's b

  • Regar Authorization objects

    Dear all, Is there any Standared Z object for personnel area based. the Requirement is we have to give the payslip authorization i.e the t code is     PC00_M40_CEDT client wants to give this as region wise. can u please tell for this if there is any

  • Event Used For Return Processing Through Transaction Code-FP09

    Hi Experts, I am facing the following problem in FP09:- After creating a return lot, when i provide return reason code for returning payments, event 1073 is not getting triggered. So, can you please provide the event that will be used for return proc

  • Performa invoice for delivery Doc

    Hi, I want to know the steps to create performa invoice for delivery doc. Regards, Supriya.