Pointer on a function

Hello,
I Would like to use a DLL (written in C). An argument of a function of
this DLL is a pointer to a function. How can I use the labview types to
have acces to this function ?
THanks for your help
PS: I hope to be enough clear
Remy CLAVERIE
CESIUM
Universite de METZ
7 Rue MARCONI
Tel : 03.87.54.73.00
Fax : 03.87.54.73.01

What the dll probably needs is a pointer to a function you've made. This is
generally known as a callback function.
This cannot be done in LV (or rather, it is very hard). You'll have to make
a DLL with the callback function, and get the entry point of that function.
This is the pointer to the function. (This is also not easy at all.)
Good luck with it,
Wiebe.
"Remy CLAVERIE" wrote in message
news:[email protected]..
> Hello,
>
> I Would like to use a DLL (written in C). An argument of a function of
> this DLL is a pointer to a function. How can I use the labview types to
> have acces to this function ?
>
> THanks for your help
>
> PS: I hope to be enough clear
>
> --
> Remy CLAVERIE
> CESIUM
> U
niversite de METZ
> 7 Rue MARCONI
> Tel : 03.87.54.73.00
> Fax : 03.87.54.73.01
>
>

Similar Messages

  • 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

  • Break Point in BTE function module

    i have function modules being triggered from 00002010
    00002020 BTEs for tcode F110.How do i set break point in them .i mean is it posible 'coz i guess a session is being created every time i run f110.
    Please help.
    Thanks and Regards,
    Venkat

    1. Set a break point in your function module.
    2. F110 Schedule a payment run (Specify a start time - Do not check Start immediately)
    3. SM37 - Select your job and enter '=JDBG'  in the command field
    4. Continue and and the program will stop at you break point
    Reward points if helpful

  • Assignment of measuring point category to functional location category

    Hi,
    If i am not doing performance based maintenance planning for functional locations then is there any need to assign/put measuring point category to functional location category during customization ?
    Regards,
    Vivek

    You could also use measurement points for Condition based maintenance functionality or for Capturing measurement readings not relevant for Maintenance planning. if your business process doesn't need both along with Performance based maintenance, its not required to assign the same.
    Regards
    Narasimhan

  • Mouse pointer does not function in System Preferences

    I have recently switched my mouse from right to left use (due to injury in the right arm). After changing the mouse does everything as expected but only in the System Preference application I cannot use the pointer of the mouse to select (the menu system does work). How can I get the functioning mouse back?

    Reset the SMC.
    Barry

  • Save Point for Cancel Functionality

    Hi all,
    I followed Frank's document below on how to implement the Cancel functionality using "Explicit ADFm Save Points in ADF Taskflows":
    http://www.oracle.com/technology/products/jdev/tips/fnimphius/cancelform/cancelForm_wsp.html
    However when running the application with logging turned on, there was this warning message:
    *******WARNING*****: createSavepoint not supported for DCBeanDataControl.*
    Upon some digging, I found that the createSavePoint method in DCBeanDataControl returns null, while its base class DCJboDataControl calls the application module's passivateStateForUndo() method.
    I hope to implement the save point functionality declaratively, can someone tell me how to obtain the DCJboDataControl class instead of DCBeanDataControl so that the createSavePoint method works?
    Thanks!
    Hai Liang

    John,
    I think there might be a problem with our view project not "knowing" that the model layer is using ADF BC. The situation is like this, we first built the ADF BC model project (the EOs, VOs and AMs). Then we went on to create a viewController project (in the same Application workspace). Because the Applications Modules from the model project appear in the Application > Data Controls tab, we just used the AMs there and assumed that the viewController project is aware that it is using ADF BC components.
    Is there some setting we have to define inside the viewController project to make it "aware" that the model layer utilizes ADF BC and thus enable the "savepoint cancel" functionality?
    Thanks!
    Hai Liang

  • Point of View functions

    We are currently setting up reports with a Current Year and Last Year using prompt for time for each. Is there a function or formula that can be used to automatically set Last Year to be one less than the current. This would eliminate prompting the Year in 2 columns. Ex. Current Year = prompt for time; Last Year = Current Year - 1.

    You don't say in your thread what reporting tool you are using. I assume it is Hyperion Reports??You could set something up in Essbase which would get round this problem. You could setup an additional member in the year dimension of Essbase, by using a combination of @PRIOR and CURRMBR shift the selection back 1 in the outline. For this to work the member would have to be Dynamic calc and as such depending on the size of your current database could affect retrieval times.Hope this helps.Paul Armitage.Analitica Ltd.

  • Break point in Planing Function

    Hi Everyone,
    A planing function is not getting executed properly. I wanted to check it by executing with trace. I am trying to do it by putting some print statement and execute with trace.
    Can some one provide syntax for print statement in planing function.
    Thank you very much.
    Regards,
    Virinchi.

    Hello,
    what function type is it?
    If it is FOX use this:
    message TNNN(message_class) with A B C D.
    where T is the type (I for information, W for warning and E for error). I suggest I for this.
    NNN is the number of message. That is used if we are using an existing message type and we want to display a particular message. In this case 001 will do.
    message_class is the message class as defined in SE91. In this particular case we do not need to define one. You can just type ZZZ and it will work, it will display the values with no message.
    A, B, C & D are FOX variables. You can display up to 4 variables with each message sentence.
    Hope this helps,
    Miguel

  • I want to spatially rectify an image using a set of control points using IMAQ functions.

    I want to spatially rectify one image to another using a set of mutual control points.  I have some Matlab code that will accomplish this but I want to use the Labview/IMAQ fucntions to accomplish it.  I already have a VI that will generate the control points
    Has any one run into sample code or any documentation that describs how this can be done?

    Hi irfocus,
                    See these links:
                    http://www.ni.com/white-paper/3169/en
                    http://www.ni.com/pdf/manuals/371007a.pdf
                   Try to provide some more information,post the VI you already have etc:-
    Thanks as kudos only

  • How can I add enhancement points in a function module

    Hi,
      I want to create the Z Enhancement implementation in ABAP. We are on ECC 6.0. I want to add a Z enchancment in funciton module MRM_FINAL_CHECK can you please let me know how
    Thanks for reading.

    Hi Srikrishna,
    Refer following link.. I'm sure these are very helpful to u..
    http://help.sap.com/saphelp_nw04s/helpdata/en/42/d356adddec036fe10000000a114cbd/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/42/d356adddec036fe10000000a114cbd/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/42/d356adddec036fe10000000a114cbd/frameset.htm
    Regards,
    Vivek

  • Assigning a variant string to a function pointer issue?

    Hello,
    This is a little complex for me to describe, so I will try my best to explain !
    I don't know if this is doable in C?
    Basically, I need a function pointer to hold the name of a function coming form a character array!
    From the examples I have seen, it seems that what I am trying to do is not the conventional way of doing function pointers, but I don't see any other way of doing what I need to do.
    In one instance, the function pointer in my code, will require to be assigned a function name like this:
    _g_BlkFuncs_ =_BUF_FUNC_PTR_ParseBlockStatus;
    and at other instances, the same function pointer needs to be assigned to a function called:
    _g_BlkFuncs_ =_INV_FUNC_PTR_ParseBlockStatus;
    and at other instances:
    _g_BlkFuncs_ =_AND_FUNC_PTR_ParseBlockStatus;
    or
    _g_BlkFuncs_ =_OR_FUNC_PTR_ParseBlockStatus;
    etc....
    The only time I will know which function to assign is when I will retrieve the first part of the function name from a table called
    _x_UserPrgBlock_. The first part being the name differentiator such as "_BUF_", "_INV_", "_AND_", "_OR_" and so forth which
    is initially stored in the one of the table members called m_LogicElement_ residing in the _x_UserPrgBlock_ table or struct.
    In the example below, I made it simple by hard coding the assigning of the m_LogicElement_ member as "_BUF_" (see the line commented as "Manual assignment line" below). In reality the  m_LogicElement_ member is assigned from
    a user defined string which will vary from time to time. 
    Here is the sample snippet which shows the issue.
    ================================STRUCT.h
    #ifndef STRUCT_H
    #define STRUCT_H
    typedef struct USR_PRG_CNV{ // User program converter table
    char m_LogicElement_[2][knst_BUF_LOGIC_ELEM]; // Name of the logic block
    } User_Prg_Block;
    #endif
    =================================_BUF.h
    #ifndef BUF_H
    #define BUF_H
    void _BUF_FUNC_PTR_ParseBlockStatus(void);
    #endif
    ================================_BUF.c
    void _BUF_FUNC_PTR_ParseBlockStatus(void){
    int i = 0;
    i = 10;
    ===============================UPC.h
    #ifndef UPC_H
    #define UPC_H
    void AssignmentFunc();
    #endif
    ===============================UPC.c
    User_Prg_Block _x_UserPrgBlock_[2];
    void AssignmentFunc(){
    strcpy(_x_UserPrgBlock_[0].m_LogicElement_, "_BUF_"); // Manual assignment line
    ===============================DFP.c
    #include "_BUF.h"
    void (*_g_BlkFuncs_) (void);
    char volatile _g_FuncPtrStrVariant_[35];
    void SomeFunction(){
    strcpy(_g_FuncPtrStrVariant_, _x_UserPrgBlock_[0].m_LogicElement_); // Get "_BUF_"
    strcat(_g_FuncPtrStrVariant_, "FUNC_PTR_ParseBlockStatus"); // Complete the function name
    // Now try to assign the full function name to the function pointer
    //_g_BlkFuncs_ = _BUF_FUNC_PTR_ParseBlockStatus;
    //_g_BlkFuncs_ = &_g_FuncPtrStrVariant_;
    _g_BlkFuncs_ = _g_FuncPtrStrVariant_; // ???
    ==============================Main.c
    void main(){
    AssignmentFunc();
    SomeFunction();
    In reference to the following line listed above:
    _g_BlkFuncs_ = _g_FuncPtrStrVariant_;
    I do realize that conventionally, it should be:
    _g_BlkFuncs_ =_BUF_FUNC_PTR_ParseBlockStatus;
    The problem I find myself faced with is that the function that "_g_BlkFuncs_" points to, has to vary in accordance to the name of the function stored in the _g_FuncPtrStrVariant_ character array! The reason is that the _g_FuncPtrStrVariant_
    array is actually built up to the name of the function based on the current contents of m_LogicElement_ residing in the _x_UserPrgBlock_ table.
    I think!!!!! that even if I use an array of function pointers, it won't solve the issue.
    In summary, in C, is there a way to assign a name of a function built from a character array to a function pointer?
    All help sincerely appreciated!
    Thanks

    I am interpreting your question a little different than Brian.
    If I understand you correctly you are asking:  "Given the name of a function as a string, how do I get a pointer to that function".
    The unfortunately fact is that C++ does not support reflection, so getting a function by name is not possible.  By the time the linker has done its thing, the function name has been stripped from code.
    This means if you need to support string lookup of a function name you need to support an alternate mechanism to handle this.  If you were using C++, a map would be an ideal mechanism.  C can still do this, but the mechanism is a lot uglier
    due to the lack of data structures like std::string and std::map.

  • Update Measurement Points on Functional Locations

    Hello Experts,
    I need create a custom program to update (add/delete/change) the measurement point's POSITIONS on functional locations. Basically the users want to clean up the functional locations which have some wrong data in them. Since I am very new to this functionality area, Can anybody please let me know - Is there a FM/Bapi to update the Measurement Point Positions on Functional Locations?
    I appreciate your help.
    Thanks.
    Edited by: sey ni on Mar 7, 2011 4:49 PM

    I think I will have to write a BDC on IK01/IK02 transactions. Not sure, if we have a better solution.

  • How to call this dll point function by labview

    Void SetCompStatusCallBack(void ((*CompStatusCallBack)(int id, int status, unsigned char conflict)))
    Sets up callback function for getting component status.
    Parameters:
    * CompStatusCallback – entry point for callback function.
    Return Value:
             None.

    left wrote:
    Void SetCompStatusCallBack(void ((*CompStatusCallBack)(int id, int status, unsigned char conflict)))
    Sets up callback function for getting component status.
    Parameters:
    * CompStatusCallback – entry point for callback function.
    Return Value:
             None.
    You don't. This is the callback protoype that would be passed as parameter to another API and as such never will be called by the caller of that API but instead be provided by that caller!
    And LabVIEW does not support function pointers at all, so you really can't do this.
    The only solution is to write a wrapper function in your DLL or in a separate DLL that translates between this interface and some more event oriented LabVIEW functionality such as user events, but unless you do know C to a fairly good level, you should probably leave that to someone else.
    Rolf Kalbermatter
    Message Edited by rolfk on 01-26-2007 04:21 PM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Where is pointer pointing to in Call Library Function

    I am  using Call Library Function (FillString) to call a function in a DLL.  I set Parameter 1 to:
    Parameter: arg1
    Type: Array
    Data Type: signed 32-bit Integer
    Dimension : 1
    Array Format: Array Data Pointer
    so the Function Prototype below in the Call Library Function dialogbox is written as:
    void FillString(long *arg1);
    At the same time, in the block diagram , there is a "input param" (array of int32) and "output param" (array of int 32)
    I wonder, when the program is in the DLL FillString function and using arg1 pointer, does "arg1" point to the data in "input param" arry or the data in "output param" array?  I don't quite understand, since normally C programs have only one return value, while the Call Library Function returns a value for every input parameter. Is the "output param" a different variable, or the same as "input param" (i.e., the same physical memory address)?

    Hi LyLee,
    if you know how many elements you need, create an array with this number of elements by using the "initialize array" function and connect it to your dll node. The output shall contain your data. If you have a string its the same. Create an empty string with the size you need. See the attached example picture.
    Mike
    Attachments:
    Unbenannt.PNG ‏3 KB

  • ISO C Binding with standard C libraries, and Fortran pointer functions

    The ISO-C-Binding extension is mostly working in Sun Fortran, so I have been experimenting with auto-generated interfaces to C libraries, which I hope to develop in to a complete SWIG addition. Ideally, many of the standard C libraries should eventually be commonly available.
    One of the problem I realized is that many C library entities are made available via macros. For example, even stdin and stdout are macros by default. The same issues came up when C++ tried to standardize access to C libraries, which resulted in an alternative library to access C functions: http://www.cplusplus.com/reference/clibrary/.
    One example is the C 'errno', which is defined as a "modifiable l-value", and traditionally was an external int, but resolves to a function in modern multi-threaded environments. Variations in C libraries probably will require C wrapper functions, but entities like errno can be made to work more like C, if Fortran pointer function results can be handled directly like a normal reference. For example, errno could be accessed as follows:
    Fortran source:
    program test_errno
    use ISO_C_Binding
    implicit none
    interface
    function errno() bind(C,name="cerrno")
    use ISO_C_Binding, only: C_int
    implicit none
    integer(C_int), pointer :: errno
    end function errno
    end interface
    write (*,*) 'errno=',errno()
    errno() = 10
    write (*,*) 'errno=',errno()
    end program test_errno
    C source:
    #include <errno.h>
    int *cerrno(void) { return &errno; }
    With the current Sun Fortran, this gives errors. I think that F2008 includes improved specifications involving pointer function results, but I have read through the F2008 draft enough to figure out the details. Ideally, a pointer function result should simply be identical to a temporary pointer variable, instead of lot of complicated specifications involving specific cases. For example, a pointer function returning a derived-type pointer should be able to access a member value like this:
    lookup_data("name")%value = 10
    where lookup_data is a function returning a pointer to a derived type, which has a member named value.
    Does anyone know how F2008 is intended to handle function pointers? Is this something where the details are still incomplete? Is it possible that a complete generalization of function-pointer results is not possible?

    The ISO-C-Binding extension is mostly working in Sun Fortran, so I have been experimenting with auto-generated interfaces to C libraries, which I hope to develop in to a complete SWIG addition. Ideally, many of the standard C libraries should eventually be commonly available.
    One of the problem I realized is that many C library entities are made available via macros. For example, even stdin and stdout are macros by default. The same issues came up when C++ tried to standardize access to C libraries, which resulted in an alternative library to access C functions: http://www.cplusplus.com/reference/clibrary/.
    One example is the C 'errno', which is defined as a "modifiable l-value", and traditionally was an external int, but resolves to a function in modern multi-threaded environments. Variations in C libraries probably will require C wrapper functions, but entities like errno can be made to work more like C, if Fortran pointer function results can be handled directly like a normal reference. For example, errno could be accessed as follows:
    Fortran source:
    program test_errno
    use ISO_C_Binding
    implicit none
    interface
    function errno() bind(C,name="cerrno")
    use ISO_C_Binding, only: C_int
    implicit none
    integer(C_int), pointer :: errno
    end function errno
    end interface
    write (*,*) 'errno=',errno()
    errno() = 10
    write (*,*) 'errno=',errno()
    end program test_errno
    C source:
    #include <errno.h>
    int *cerrno(void) { return &errno; }
    With the current Sun Fortran, this gives errors. I think that F2008 includes improved specifications involving pointer function results, but I have read through the F2008 draft enough to figure out the details. Ideally, a pointer function result should simply be identical to a temporary pointer variable, instead of lot of complicated specifications involving specific cases. For example, a pointer function returning a derived-type pointer should be able to access a member value like this:
    lookup_data("name")%value = 10
    where lookup_data is a function returning a pointer to a derived type, which has a member named value.
    Does anyone know how F2008 is intended to handle function pointers? Is this something where the details are still incomplete? Is it possible that a complete generalization of function-pointer results is not possible?

Maybe you are looking for