When I use Call Library Function Node in real time, is the DLL loaded once for all or load every time it is called?

When I use Call Library Function Node in real time, is the DLL loaded once for all or load every time when it is called?
I have a time critical real time application, in which I use a piece of DLL function developed by C++.  It is OK?  Could any senior developer assure me?
Thank you in advance.
Solved!
Go to Solution.

qing_shan61 wrote:
When I use Call Library Function Node in real time, is the DLL loaded once for all or load every time when it is called?
Once
qing_shan61 wrote:
I have a time critical real time application, in which I use a piece of DLL function developed by C++.  It is OK?
OK
Be sure that all DLL calls are thread safe (do not perform calls in UI thread).
Also for real-time application you need real-time OS.
Andrey.

Similar Messages

  • Parameters into Call Library Function Node not being passed

    I am trying to configure an instrument using IVI Instrument drivers. In the first vi that does this, the instrument (a sig gen) is being set correctly to the desired frequency and power. In a second vi I try to change the frequency and power, the sig gen does not change.
    If I run the second vi stand-alone with the original settings, again there is no change. But if I change the value of frequency or power by any amount, that parameter is now set properly on the sig gen.
    When I look at the IVI vi, I can see that the parameters I send in are getting to the Call Library Function Node.
    Any idea what the problem is.
    Thanks.
    p.s., Are there instructions on how to paste a picture or link to a vi into my post. This question would have been a lot easier and clearer to ask.

    Hi cgantz,
          While it sounds, possibly, like a "state-caching"-related bug in the IVI driver, it certainly would be good to have a look at your code.   Look a the bottom-left area of the "Message Body" when replying - there's an "Attachment" tool for this purpose!
    Cheers.
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • LabVIEW PDA reports COREDLL.DLL error when using Call Library Function Node

    I'm trying to build a LV PDA app that calls an external DLL file built using embedded visual C. When configuring the Call Library Function node I select the stub DLL, configure the I/O parameters and select OK. When the configuration dialog closes I get the following error:
    LabVIEW: LabVIEW.exe - Unable to Locate Component
    This application has failed to start because COREDLL.DLL was not found. Re-installing the application may fix this problem.
    I do not get this error when using the configuration dialog in the example VIs.
    Any suggestions as to the cause and/or the solution?
    Thanks,
    Ryan

    Hello -
    When you create a PDA VI that calls a DLL, you must include the .c or .lib file that corresponds to the DLL. Take a look at these documents:
    LabVIEW PDA Module Build Errors with VIs that Call DLLs
    Why Do I Receive Errors When Calling a C++ DLL from a Call Library Node Using the LabVIEW PDA Module...
    How To Call External Code in LabVIEW PDA for Palm OS
    H
    ow To Call External Code in LabVIEW PDA for Pocket PC
    Hope this helps!
    S Vences
    Applications Engineer
    National Instruments

  • Failed to run parallel path when using call library function node in LV2009

    I have a problem with two parallel paths not being run in parallel on LabView 2009.
    See the image below.
    This code initializes an external device, the upper part contains a call library function node to download my code into the device. When done, the function returns and the "Done" flag is set to True.
    The lower part contains a call library function node to check the download status, reporting the percentage of downloaded code.
    This updates a progress bar that is referenced by the calling VI module and this works fine in LV 7, 8 and 2011. The lower path of the VI updates the progress bar while the CLFN in the upper part is still downloading code to my device.
    Somehow, in LV2009 this does not work when running this inside my application. When running just the calling VI (the window showing the progress bar) it works but not when that VI is called by my application.
    Is there some limit on parallel threads that is different in 2009 than in other versions ?
    Or is there some other problem in 2009 that might cause this problem ?
    My labview version is 9.0f3 (32-bit).
    Regards,
    Rob

    I've just installed the DETT tool and checked what the different versions of LabView do.
    In LV2009 the application instance runs in a thread (5) but the modal dialog (the VI above) then drops to thread 0 and stays in thread 0.
    In LV2011, stays in the same thread as the application instance and only a trigger event (this could be the progress bar reference?) is executed in thread 0.
    So it seems there is a 'feature' in LV2009 where modal dialogs are by default not following the preferred execution system set in the VI properties ...
    When I change this from "same as caller" into another thread (I used "other 1") then my progress bar works as expected.
    I'm not a LabView thread expert (not even a novice ) so I'm just guessing that "other 1" as a thread is OK. This VI only runs during startup of the application to download the code to my device.
    To answer Ben's question: "What thread does a modal VI run in?":
    In LV2009, the modal VI runs in thread 0 (UI thread ?). When the preferred execution system is set to another thread, the modal dialog still starts in thread 0 but then switches over to the other thread.
    In LV2011, the model VI runs in the caller's thread (preferred execution system set to "follow caller") from start.
    Thanks,
    Rob

  • Call library function node with array of clusters using array data pointer

    Hello all.
    I am writing a LabVIEW wrapper for an existing DLL function.
    The function has, as one of its parameters, an array of structs.  The struct is very simple, containing two integers.  I am using the call library function node to access it.
    In Labview I created an array of clusters, where the cluster has two 32-bit integers as its members.  So far, so good.
    Now I have to pass this in to the Call Library Function Node.  Here I am running into trouble.
    I have used The topic in LAVA and The topic in the knowledge base as my primary sources of information, though I have read a bunch of forum topics on the subject too.
    I do understand that I could write a new function which takes as a parameter a struct with the size as the first member and an array as the second, and I might just do this and have it call the regular function, but I was hoping to do it more simply.
    According to the C file which LabVIEW generates for me from the CLFN when I choose "Adapt to Type" and "Array Data Pointer", the prototype it is expecting is:
    int32_t myFunc(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, void data[], int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    And the prototype of the function in my DLL is
    int borland_dll myFunc(DWORD handle, usint channel,
    int FIFOnumber, struct mStruct *data, int numWords, int *actualLoaded, int *actualStartIndex);
    This looks like a match to me, but it doesn't work (I get garbage in data).  From the topic in LAVA referenced above, I understood that it would work.  It does not.
    If I cast data to the pointer-to-pointer I get when I generate c code by wiring my struct to a CIN and generating, then I seem to get what I expect. But this seems to work when I choose "pointers to handles" too, and I would expect array data pointer to give a different result.
    Is there any way to get this to work directly, or will I have to create a wrapper?  (I am currently using LabVIEW 2011, but we have customers using 2009 and 2012, if not other versions as well).
    Thank you.
    Batya
    Solved!
    Go to Solution.

    OK, here is more detailed information.
    I have attached the VI.
    This is the code from the  "C" file created by right-clicking the CLN and creating a "C" file. 
    When the parameter in the CLN is set to "array data pointer":
    /* Call Library source file */
    #include "extcode.h"
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, void data[], int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, void data[], int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex)
    /* Insert code here */
     When the parameter is "pointers to handles":
    /* Call Library source file */
    #include "extcode.h"
    /* lv_prolog.h and lv_epilog.h set up the correct alignment for LabVIEW data. */
    #include "lv_prolog.h"
    /* Typedefs */
    typedef struct {
    int32_t control;
    int32_t data;
    } TD2;
    typedef struct {
    int32_t dimSize;
    TD2 data[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    #include "lv_epilog.h"
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex)
    /* Insert code here */
     When the parameter is set to "handles by value":
    /* Call Library source file */
    #include "extcode.h"
    /* lv_prolog.h and lv_epilog.h set up the correct alignment for LabVIEW data. */
    #include "lv_prolog.h"
    /* Typedefs */
    typedef struct {
    int32_t control;
    int32_t data;
    } TD2;
    typedef struct {
    int32_t dimSize;
    TD2 data[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    #include "lv_epilog.h"
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex)
    /* Insert code here */
    As to the DLL function, it is a bit more complicated than I explained above, in the current case.  My VI calls the function by this name in one DLL, and that DLL loads a DLL and calls a function (with the same name) in the second DLL, which does the work. (Thanks Rolfk, for helping me with that one some time back!)
    Here is the code in the first ("dispatcher") DLL:
    int borland_dll Load_Transmit_FIFO_RTx(DWORD handle, usint channel, int FIFOnumber, struct FIFO_DATA_CONTROL *data, int numWords, int *actualLoaded, int *actualStartIndex)
    t_DispatchTable *pDispatchTable = (t_DispatchTable *) handle;
    int retStat = 0;
    retStat = mCheckDispatchTable(pDispatchTable);
    if (retStat < 0)
    return retStat;
    if (pDispatchTable->pLoad_Transmit_FIFO_RTx == NULL)
    return edispatchercantfindfunction;
    return pDispatchTable->pLoad_Transmit_FIFO_RTx(pDispatchT​able->handlertx, channel, FIFOnumber, data, numWords, actualLoaded, actualStartIndex);
    borland_dll is just "__declspec(dllexport)"
    The current code in the DLL that does the work is:
    // TEMP
    typedef struct {
    int control;
    int data;
    } TD2;
    typedef struct {
    int dimSize;
    TD2 data[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    // END TEMP
    int borland_dll Load_Transmit_FIFO_RTx(int handlertx, usint channel, int FIFOnumber, struct FIFO_DATA_CONTROL *data, int numWords, int *actualLoaded, int *actualStartIndex){
    struct TRANSMIT_FIFO *ptxFIFO; //pointer to transmit FIFO structure
    usint *pFIFOlist; //pointer to array of FIFO pointers to FIFO structures
    int FIFOentry, numLoaded;
    usint *lclData;
    usint nextEntryToTransmit;
    // TEMP
    FILE *pFile;
    int i;
    TD1** ppTD = (TD1**) data;
    TD1 *pTD = *ppTD;
    pFile = fopen("LoadFIFOLog.txt", "w");
    fprintf(pFile, "Starting Load FIFO with %d data words, data pointer 0x%x, with the following data&colon; \n", numWords, data);
    for (i = 0; i < numWords; i++) {
    fprintf(pFile, "%d: control--0x%x, data--0x%x \n", i, data[i].control, data[i].data);
    fflush(pFile);
    fprintf(pFile, "OK, using CIN generated structures: dimSize %d, with the following data&colon; \n", pTD->dimSize);
    for (i = 0; i < numWords; i++) {
    fprintf(pFile, "%d: control--0x%x, data--0x%x \n", i, pTD->data[i].control, pTD->data[i].data);
    fflush(pFile);
    // END TEMP
    if ((handlertx) <0 || (handlertx >= NUMCARDS)) return ebadhandle;
    if (cardrtx[handlertx].allocated != 1) return ebadhandle;
    pFIFOlist = (usint *) (cardrtx[handlertx].segaddr + cardrtx[handlertx].glob->dpchn[channel].tr_stk_ptr​);
    pFIFOlist += FIFOnumber;
    ptxFIFO = (struct TRANSMIT_FIFO *)(cardrtx[handlertx].segaddr + *pFIFOlist);
    //use local copy of ptxFIFO->nextEntryToTransmit to simplify algorithm
    nextEntryToTransmit = ptxFIFO->nextEntryToTransmit;
    //on entering this routine nextEntryToLoad is set to the entry following the last entry loaded
    //this is what we need to load now unless it's at the end of the FIFO in which case we need to wrap around
    if ( ptxFIFO->nextEntryToLoad >= ptxFIFO->numEntries)
    *actualStartIndex = 0;
    else
    *actualStartIndex = ptxFIFO->nextEntryToLoad;
    //if nextEntryToLoad points to the last entry in the FIFO and nextEntryToTransmit points to the first, the FIFO is full
    //also if nextEntryToLoad == nextEntryToTransmit the FIFO is full and we exit without loading anything
    if (( (( ptxFIFO->nextEntryToLoad >= ptxFIFO->numEntries) && (nextEntryToTransmit == 0)) ||
    ( ptxFIFO->nextEntryToLoad == nextEntryToTransmit)) && (ptxFIFO->nextEntryToLoad != INITIAL_ENTRY)){
    *actualLoaded = 0; //FIFO is full already, we can't add anything
    return 0; //this is not a failure, we just have nothing to do, this is indicated in actualLoaded
    numLoaded = 0;
    lclData = (usint *)data; //must use 16 bit writes to the module
    //conditions are dealt with inside the for loop rather than in the for statement itself
    for (FIFOentry = *actualStartIndex; ; FIFOentry++) {
    //if we reached the end of the FIFO
    //if the module is about to transmit the first element of the FIFO, the FIFO is full and we're done
    //OR if the module is about to transmit the element we're about to fill in, we're done - the
    //exception is if this is the first element we're filling in which means the FIFO is empty
    if ((( FIFOentry >= ptxFIFO->numEntries) && (nextEntryToTransmit == 0)) ||
    ((FIFOentry == nextEntryToTransmit) && (FIFOentry != *actualStartIndex) )){
    *actualLoaded = numLoaded;
    //set nextEntryToLoad to the end of the FIFO, we'll set it to the beginning next time
    //this allows us to distinguish between full and empty: nextEntryToLoad == nextEntryToTransmit means empty
    ptxFIFO->nextEntryToLoad = FIFOentry;
    return 0;
    //we reached the end but can continue loading from the top of the FIFO
    if ( FIFOentry >= ptxFIFO->numEntries)
    FIFOentry = 0;
    //load the control word
    ptxFIFO->FifoData[FIFOentry * 3] = *lclData++;
    //skip the high of the control word, the module only has a 16 bit field for control
    lclData++;
    //now put in the data
    ptxFIFO->FifoData[(FIFOentry * 3) + 2] = *lclData++;
    ptxFIFO->FifoData[(FIFOentry * 3) + 1] = *lclData++;
    numLoaded++;
    //we're done because we loaded everything the user asked for
    if (numLoaded >= numWords) {
    *actualLoaded = numLoaded;
    ptxFIFO->nextEntryToLoad = FIFOentry+1;
    return 0;
    //if we reached here, we're done because the FIFO is full
    *actualLoaded = numLoaded;
    ptxFIFO->nextEntryToLoad = FIFOentry;
    fclose (pFile);
    return 0;
     As you can see, I added a temporary diagnostic with the structures that were created in the "Handles by value" case, and print out the data.  I see what is expected, whichever of the options I pick in the CLN!  
    I understood (from the information in the two links I mentioned in my original post, and from the name of the option itself) that "array data pointer" should pass the array of data itself, without the dimSize field.  But that does not seem to be what is happening.
    Batya
    Attachments:
    ExcM4k Load Transmit FIFO.vi ‏15 KB

  • Call Library Function Node 'Wrapper.C​reate': Library not found or failed to load. using windows 7 64 bits

    Dear all
    I try to interface my spectrometer (NIRquest from ocean optics) using labview on my 64 bits cumputer using windows 7.
    I have absolutely no problem to run the spectrometer with the program dedicated to the spectrometer (called Spetrasuite).
    I've installed "OmniDriverSPAM-1.66-win64-development-installer.e​xe" and everything went right.
    When I select a VI in LabView (e.g."wrapper_create.vi") from the wrapper.llb, LabView returns an error :
    "Call Library Function Node 'Wrapper.Create': Library not found or failed to load."
    I chek the call library function, but everyting seems to be right :
    I use LabView 8.6.1 and my others *.vi are running perfectly...
    Do you have any idea from where does the problem comes ?
    Thank you very much

    Hello Flanguy,
    In addition to smercurio_fc's feedback I can confirm that LabVIEW 8.6.1 doesn't exist in 64-bit version.
    Officially, LabVIEW 8.6.1 doesn't support Windows 7 either.
    The minimal version of LabVIEW you would need to both support Windows 7 and exist in 64-bit version is LabVIEW 2009 64-bit or any 64-bit versions which are more recent.
    In the two links (1 & 2) you can find more background information.
    Kind Regards,
    Wouter
    National Instruments Belgium

  • Using Call Library Function Node To Return C++ Structure Informatio​n

    Hi everyone.  This question is for all you LabVIEW gurus out there.
    I am trying to call a function from a .dll to get information from a structure about a device (FT232H chip).  I am using the "Call Library Function Node" to do this in LabVIEW.  My issue is I do not know how to set up the "Call LIbrary Function Node" parameter for a C++ structure.  How do I set up the pointer to FT_DEVICE_LIST_INFO_NODE structure using the "Call Library Function Node" so that I can read back the device information?
    The details of the C++ function and the structure are below.
    Thanks for everyone's help!
    The C++ function is the following:
    FT_STATUS I2C_GetChannelInfo (uint32 index, FT_DEVICE_LIST_INFO_NODE *chanInfo)
    In = index (Index of the channel)
    Out = *chanInfo (Pointer to FT_DEVICE_LIST_INFO_NODE structure)
    The pointer to the FT_DEVICE_LIST_INFO_NODE is defined as:
    typedef struct _FT_DEVICE_LIST_INFO_NODE {
    ULONG Flags;
    ULONG Type;
    ULONG ID;
    DWORD LocId;
    char SerialNumber[16];
    char Description[64];
    FT_HANDLE ftHandle;
    } FT_DEVICE_LIST_INFO_NODE;

    Dennis/Nathan,
    I tried to set up the "Call Library Function Node (CLFN)" correctly in order to read out Device Information from a FTDI Chip (FT232H) but when I run the VI LabVIEW crashes on me always.
    I have attached the code.  For the FT_DEVICE_LIST_INFO_NODE structure I passed into the "CLFN" a constant cluster of all the structure elements and then I set up the node to:
    Type: Adapt to Type
    Data format: Handles by Value
    I think LabVIEW crash may have something to do with the fact that the output of the dll function is using a pointer to a structure.  With the Handles by value Data format I am unable to set the Pointer to structure.
    Can you please take a quick look at the code to see if I am setting the CLFN up correctly?
    Thanks!
    Once again, here are the C++ Code Details:
    FT_STATUS I2C_GetChannelInfo (uint32 index, FT_DEVICE_LIST_INFO_NODE *chanInfo)
    In = index (Index of the channel)
    Out = *chanInfo (Pointer to FT_DEVICE_LIST_INFO_NODE structure)
    The pointer to the FT_DEVICE_LIST_INFO_NODE is defined as:
    typedef struct _FT_DEVICE_LIST_INFO_NODE {
    ULONG Flags;
    ULONG Type;
    ULONG ID;
    DWORD LocId;
    char SerialNumber[16];
    char Description[64];
    FT_HANDLE ftHandle;
    } FT_DEVICE_LIST_INFO_NODE;
    Attachments:
    FT_I2C_GetChannelInfo.vi ‏14 KB

  • Executable created in LabVIEW 7.1 containing Call Library Function Node runs but creates error when Call Library Function Node is executed

    I have created a simplee application that controls a piece of equipment with all control via a supplied dll.  Hence, there are a number of Call Library Function Nodes within the code and a modicum of other LabVIEW code.  Everything works fine as a LabVIEW application, but when converted to an executable, although the application runs and functions, as soon as any Call Library Function Node is executed, calling from the dll, I get the C++ debug error in the attachment.
    Is this something that I can solve from within LabVIEW, or is the problem likely buried in the dll?
    Damian
    Attachments:
    CLFN error.JPG ‏22 KB

    Hi Wise,
    Try building an executable from a very simple VI that makes one call to the dll. Have you also try using the Call Library Function node on other simple dlls that you know will work?
    Regards,
    Stanley Hu
    National Instruments
    Applications Engineering
    http://www.ni.com/support

  • Passing Variant to dll using call library function node

    Hi,
    Using LV2012
    I have a dll that the following prototype:
    SetTestResult(LPCTSTR Serial, int Test, int Result, VARIANT measuredValue);
    How can I pass the Variant to this node when my variant can be either int or float.
    I have tried "ToVariant" function but it is not sending data and gets error 1517 on LabView. For configuration parameters for variant I have used ActiveX type and datatype as activeX Variant Pointer.
    So for call library function node my prototype looks like this:
    int32_t SetTestResult(CStr Serial, int32_t Test, int32_t Result, VARIANT  *measuredValue);
    Can someone help me understanding What am I doing wrong here please?
    Thank you,
    Hiren
    Hiren Patel

    Hello Hiren,
    Posting your code (even without the DLL) would definitely make it easier for people to point out potential issues.  Here is an example that demonstrates passing an ActiveX variant to a DLL built in CVI, I would suggest cross-checking the way the Call Library Function Node has been configured.
    Example:Transferring an ActiveX Reference Pointer to a CVI DLL
    http://zone.ni.com/devzone/cda/epd/p/id/3343
    Regards,
    Tom L.

  • How to implement a callback function using LabView's Call Library Function Node?

    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    The SDK.h deacribes the function as:
    //  Function:   SdkSetPropertyEventHandler
    SdkError SDKAPI SdkSetPropertyEventHandler(
                SdkCameraRef                    inCameraRef,
                SdkPropertyEvent                inEvnet,          
                SdkPropertyEventHandler         inPropertyEventHandler,
                SdkVoid*                        inContext );
    //  Description:
    //       Registers a callback function for receiving status
    //          change notification events for property states on a camera.
    //  Parameters:
    //       In:    inCameraRef - Designate the camera object.
    //              inEvent - Designate one or all events to be supplemented.
    //              inPropertyEventHandler - Designate the pointer to the callback
    //                      function for receiving property-related camera events.
    //              inContext - Designate application information to be passed by
    //                      means of the callback function. Any data needed for
    //                      your application can be passed.
    //      Out:    None
    //  Returns:    Any of the sdk errors.
    A separate header file called SDKTypes.h contains the following data:
    typedef  SdkUInt32  SdkPropertyEvent;
    typedef  SdkUInt32  SdkPropertyID;
    typedef  void       SdkVoid;
    typedef  struct __SdkObject*    SdkBaseRef;
    typedef  SdkBaseRef    SdkCameraRef;
     SdkPropertyEventHandler
    typedef SdkError ( SDKCALLBACK *SdkPropertyEventHandler )(
                        SdkPropertyEvent        inEvent,
                        SdkPropertyID           inPropertyID,
                        SdkUInt32               inParam,
                        SdkVoid *               inContext );
    Thanks for your help.
    Alejandro
    Solved!
    Go to Solution.

    alejandroandreatta wrote:
    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    Basically you do not do that. LabVIEW does not know pointers and certainly not function pointers. What you should do instead is writing a C DLL that implements the callback and also exports a function to be called by LabVIEW that translates between the callback and a LabVIEW user event. Look for PostLVUserEvent() here on the NI site to find examples how to do that.
    Rolf Kalbermatter
    Message Edited by rolfk on 02-11-2009 08:00 PM
    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!

  • Call Library Function Node.vi using problem

    Hi, 
     我用Labwindows 编了个读文件的程序然后生成动态库, 然后在LabVIEW里调用该动态库(Call Library Function Node), 即向该动态库传递文件名及路径和某一字符串,然后该动态库打开相应路径文件从中读出并返回三个参数值,可是每次的返回值总显示打开文件失败, 该函数在Labwindow里没有问题. 在LabVIEW里如何调试来确定传到动态库的参数格式是没有问题的呢?任何的指点迷津,不胜感激!
    Frank,

    xiejiezhou wrote:
    Thank Georges and Rolf Kalbermatter,
     I changed the runtime support with " Full Runtime Engine" instead of " LabVIEW Real-Time Only" before, it's work now, but the output parameters returned are irregular incorrect characters. My funciton prototype is:
    DLLEXPORT long  CollectParameter(char *NomFile, char *szNomParagraph, char *Command[], char *Type[], char *Value[]) 
    so how to configure the type in LabVIEW respectively?  I tried every types, just "c String Pointer" is ok, but returned value irregular & incorrect.
    As Geogre's suggestion,  i should add my code as below function generated by LabVIEW, is it?
    ong CollectLabel(char szNomFile[], char szNomParagraph[], char Command[],  char Type[], char Value[])
     /* Insert code here */
    Frank
    The char *Command[], char *Type[], char *Value[] parameters are parameters that you can not create with LabVIEW. This are arrays of strings and and LabVIEW has a completely different idea about how to place strings and arrays in memory than what is used in C.
    And while LabVIEW supports translation of the top level type to C compatible pointers it does not have any option to let you configure it to translate embedded elements in parameters (the strings in the array) to be translated too.
    But to be honest what you seem want to do is read in a file, do some parsing and then return parameters taken out of that file. Doing that all in LabVIEW would be SOOOOOOOOOOOO much easier.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Use call library function node

    I try to use call library function node to call a function in DLL and retrieve info stored in the C structure data type, can I do it? If yes, how ? Thanks.

    Have a look at the article Configuring the Call Library Function Node

  • Using variants in Call Library Function Node parameters

    Can I use Call Library Function Node to send variant data?
    Attached is a VI. Here's the C code:
    int MM_FUNC mmDaqDll_407DB
        ( IN char *pcUdlPath
        , IN char *pcTableName
        , IN void *pvData
        int nStat = 1;
        //System:bject *varData = ((System:bject *)vData);
        MessageBox(NULL, pcUdlPath, pcTableName, 0);
        return nStat;
    } // mmDaqDll_407DB()
    I get the void pointer. I was hoping for a solution that did not use void*.
    What is the best way to pass void data to a DLL?
    Attachments:
    DaqDllMon407DB.vi ‏18 KB

    Hi Mefitzpatrick,
    Here is a similar forum that addresses this issue:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=48886&requireLogin=False
    They mention using the Adapt to Type property of the function node inputs, have you tried this?
    Let me know if this doesn't answer your question.
    Sappster

  • How to call a C pointer from call library function node

    I have a client/server application which the client I am trying to develop using Labview.  When I use to communicate the server and the client using the program provided by the manufacter, the system works perfectly.
    Now, I am trying to develop a system using labview, because I need to get another things.
    I have the DLL provided by the manufacter and the .h too, so I can check the functions parameters. One of these functions needs to be called using a struct element. Probably, the function's DLL instantiates the elements of this struct.  I use the call library function node to do it.
    When I receive the data, the function returns to me the struct that I passed as a parameter before, and then I can read all the elements of the struct, except the string element that returns nothing. The struct elements that are numerical, I can read them perfectly.
    Another thing that is important to say, is that the string data was not returned in fact by the DLL function that the system calls. I have to pass a pointer (I use it as unsigned 16 in Labview, but I tried before as string and unsigned 8) as a parameter, and this pointer will point to the memory location that the string is. When I try to read what is returned by the function, I can read nothing. The same function returns that the size of data that is returning is 17 bytes.
    How can I solve it?
    Thank you in advance

    Did you take a look at the example that ships with LabVIEW that shows how to do all sorts of data passing to DLLs. I believe your situation is one of the examples listed. You can find the example VI in the "<LabVIEW install directory>\examples\dll\data passing" directory.

Maybe you are looking for

  • ITunes stops working when trying to play purchased video

    Hey Everyone, For some reason whenever I try to play a video or TV program that I purchased from the iTunes store it causes iTunes to shut down and it won't play the video. It does bring up the player for a few seconds then just hangs and a few secon

  • Duplication Check for Business Partner

    Hi, In my project for BP Duplicate check  i have activated Trex Settings. The duplication Check is based on only Address of the BP. But my we need to check duplication based on Pan number given in Identification Tab. Can we check duplication based on

  • Firefox uses more than 2GB RAM

    Hi, I'm using HP laptop with OS Windows 7 Professional edition. I observed in the task bar that firefox consumes more than 2GB of ram just with 3 or 4 tabs. Could you please let me know what are the memory tweaks or steps to reduce the memory consump

  • Nokia Lumia 920

    Hello. why can't I move photos from nokia lumia 920 to iphoto? It's possible?

  • F.03 clarification-year end

    Hi When we executed F.03 financial comparitive analysis we are getting around 6 accounts in G/L and 3 accounts in AR as accounts in errors showing some debit or credit balance differences.(When had a glance,in  some cases debit and credit differences