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

Similar Messages

  • VI analyzer: Wire under object test fails with Call Library Function Nodes

    Hi,
    If I wire a Call Library Function Node with an ErrorIn and an ErrorOut, the VI Analyzer Test "Wire under Object" fails always with two occurrences per Call Library Function Node.
    A double click to the occurrence highlights the error lines connected with the call... node.
    The test does not fail, if the error lines are not connected.
    Thanks!
    H
    Solved!
    Go to Solution.

    This became a problem when Call Library Nodes got error terminals (and optional path terminals) in LabVIEW 8.20.  I should be able to get a fix in to VI Analyzer Toolkit 2010.
    Thanks for taking the time to report the bug.
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • 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

  • 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.

  • 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!

  • Execution time for Call Library Function Node

    I am experimenting with the Call Library Function Node block in LabVIEW and am curious if it should be running faster than what I'm seeing.  For testing purposes, I have compiled and transfered to my RT target the .out file from the KB article http://digital.ni.com/public.nsf/allkb/81D1172E3C28A5E4862575CC0076A230 (I'm using the vxworks 6.1 version).  The function in the .out file just multiplies two inputs together, adds a constant, and returns the result.  I have put this inside a 1 kHz timed loop with a commanded period of 1 ms and via the Ticks(ms) block and shift registers I calculate the amount of time per loop execution.  This process is apparently taking 5 ms per cycle and to me that seems slow.  Is that roughly the correct execution time for this kind of setup?  I will attach my test .vi file.
    What I'm using:
    Windows 7
    LabVIEW 2009 SP1
    NI-cRIO 9024 with NI-RIO 3.4.0
    Solved!
    Go to Solution.
    Attachments:
    test DLL.vi ‏31 KB

    First off, the way you are doing timing isn't necessarily accurate because you don't know when the tick count VI is being called. For example, if it gets called on one iteration after your call library node executes, and the next iteration it gets called before the CLFN it executes, the subtraction doesn't include the call of the CLFN so you aren't seeing the true time it is taking for the dll to be called.
    Where it says "error" on the top left hand corner of your loop. left click and choose previous iteration timing. Also, do you have the ability to choose a 1 Mhz clock? Are you sure it's actually being run on the RT and not on your PC? Running it on the PC would definitely make it difficult to execute at a 1 kHz rate.
    CLA, LabVIEW Versions 2010-2013

  • 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

  • Call Library Function Node: library not found or failed to load

    Hello,
    I had a VI that could not find some of the dll functions it needed.  It works on one machine and not on another.  So foolishly I copied the dll in question from the working machine and pasted it over the one on the non-working machine. 
    Now all my math functions are broken on the machine I copied the dll too.  The error is "Call Library Function Node: library not found or failed to load"
    And if I try to relink in the VI I get "Error loading C:\National Instruments\LabVIEW 8.2\resource\lvanlys.dll" A dynamic link library (DLL) initialization routine failed."
    I tried a repair labview and that did not help.
    I tried uninstall and reinstall labview and that did not help!
    Please help me fix this!
    Version 8.2
    dll: C:\National Instruments\LabVIEW 8.2\resource\lvanlys.dll
    Jim

    What library did you first copy?
    Also lvanlys.dll depends on the Intel Math Kernel Library that gets installed in a different location "C:\Program Files\National Instruments\Shared\MKL".
    This Intel Math Kernel Library again depends on the Visual C runtime libraries. Most likely you replaced one of those runtime libraries somehow and now the Math Kernel Library (MKL) fails to initialize which causes thelvanlys.dll to fail its load.
    Without a good view on your system and what other NI software you have installed it is very hard to recommend a good way of proceeding. There are various versions of the MKL used by various versions of NI products and just deleting the entire MKL folder might get you into trouble with other NI tools.
    Deinstalling everything from NI, deleting the entire National Instruments folder and then reinstalling what you need would be the most safe proceeding.
    And next time don't just copy some Visual C runtime libraries between machines. Their dependencies are complicated at the least and simply not graspable by us mere mortals. Use the according C runtime installer for the version you need as that installer will take care of installing the right versions of C runtime components and registering everything proberly so you do not usually run into problems with other applications using different versions of the C runtime.
    Message Edited by rolfk on 03-01-2010 10:26 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call library function node: function not found in library

    I'm using Labview 6.1 and Windows XP.  I am trying to open some code, but it opens up with a broken arrow.  The error is Call Library Function Node:function not found in library.  Tried to configure the node, but no change.  Moved the DLLs to various directories (keeping them together) but again no change. 
    This code has been compiled and is working fine.  I'm just trying to run the source code to make some modifications.  Any suggestions? 
    Thanks
    CarlosV

    Thanks for the suggestions.  Tried it but had the same results.  The library I'm using is hpe1413_32.dll. 
    One thing I forgot to mention....doing a configure on the node, it comes up with the library: hpvscp32.dll and the function: hpe1413_error_message
    The function doesn't exist in the library.  So I set the path to hpe1413_32.dll which does contain the function. 
    After closing the configuration window and opening it up again, the library shown is hpvscp32.dll
    From what I can tell, there are three libraries involved:hpe1413_32.dll, hpe141332v.dll, and hpvscp32.dll
    Thanks again.
    Carlos

  • Call Library Function Node produces error in Windows 7

    Hi,
          I've created a simple program using LabVIEW 8.5 that uses calls in winscard.dll to read and write to a Smart Card.  I use Call Library Function Node to call functions in C:\Windows\System32\winscard.dll.  This program works without a problem in Windows XP both within LabVIEW 8.5 and once it is compiled.  I am also able to get this program to run without a problem when I run it in LabVIEW 2011 on a Windows 7 machine.  However, when I run the program compiled with LabVIEW 8.5 on Windows 7, the first call I make to a function in the DLL returns Windows System Error 2 (file not found).  Subsequent calls to other DLL functions return errors about invalid handles, which makes sense. 
    Can I compile the project in LabVIEW 2011 and save it back to a LabVIEW 8.5 compatible project file?
    Thanks,
    Jason Mazzotta

    Bannu wrote:
    Hi All,
    I am also having the similar issue. I have a VI, developed in LV2010 on Windows XP machine with a dll call using "Call Library Function Node".
    It is working fine in all WindowsXP machines but not in Window7 PCs.
    Getting Error when i tried to open in Windows7 machine:
    Error loading "DLL path....". Invalid access to memory location.
    Please let me know how to make this working on both machines [XP and Win7].
    Thanks,
    Soumya
    Way to little information to say anything useful about it. Attach your VI, explain what it should do, explain what the DLL is you try to call! You don't call your mechanicien saying your car doesn't start and expect him to diagnose the problem over the phone either with that much information.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • DLL C/C++ syntax for Call Library Function Node

    Hello,
    I am interested in calling DLL from Labview and found several intersting tutorials on the Call Library Function Node. One interesting tutorial is Building a DLL with Visual C++ http://zone.ni.com/devzone/cda/tut/p/id/3056
    One can notice in the example presented in this tutorial that the parameters that are outputs of the exported function are of type pointers. And I am curious about the theory behind this. 
    I looked also at the example in LabVIEW Call DLL.vi and it seems that all outputs are pointers to the desired data type.
    I tried to write a short code where I assign a new value for one parameter in the export function. But this value is not updated in Labview. To make it clear: assume 50 is passed to an input parameter (on the left side of the Call Lib func Node). In the function, i assign 100 to this variable and expect this value on the output in Labview (right side indicator of Call Node) but the output remains 50.
    I am trying to change my code but i get errors in linking (compiling is ok) that I cannot understand. LINK : fatal error LNK1168: cannot open Debug/DoseDLL.dll for writing
    Error executing link.exe.
    I don't get any error with the code provided in the above tutorial   so i am trying to reproduce a similar code...
    Thank you

    Hello,
    Please find attached the source code in C, the DLL and the vi. 
    you notice in the C code that I set variable dose=100 and this is the value I would like to export as an output for labview (right side of Node) for whatever value in the input (i put 50 for input dose). In the current code, the same value of input dose (50) is passed to the output (i assume it has to do with the reference ?). The idea is that variables dose and rate should be set/calculated in the DLL function. 
    Thank you!
    Attachments:
    DoseDLL3.cpp ‏1 KB
    DoseDLL.vi ‏8 KB

  • 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

  • Is a call library function node in LabView 8.6 synchronous or asynchronous?

    I tried setting a sub-VI with a call library function node in it to "subroutine" execution status.  The error list indicated that the Call Library Function node in the block diagram was an asynchronous node.  The LabView on-line help content indicates
    "...CINs and shared libraries execute synchronously, so LabVIEW cannot use the execution thread used by these objects for any other tasks. "
    Does anyone know for sure what the status of a Call Library Function is?  Does it depend upon the specific code in the DLL being called?
    Thanks,
    Mike H.

    Based on the help page it looks like it should execute asynchronously.
    The thing in the description that leads me to believe they execute asynchronously is that you can configure the library to run as a multi-threaded operation.
    Please take a look here to see the difference between synchronous and asynchronous execution.
    Since the code even has the ability to be multi-threaded, you can consider it as running in parallel to your other code.
    Any data returned is passed to the thread that called that function.
    Cory K

  • An exception occured within the external code called by a Call Library function Node

    Good Morning,
    I built a VI that contains Matlab nodes in Labview 8.0.  I made an executable and gave it to a colleage to use who is running Windows XP.  I see in the folder C:\Program Files\National Instruments\Shared\LabVIEW Run-Time that she has 7.1 and 8.0 run time engines installed.
    On Friday the executable ran great on her machine.  Today, when she tried running it I received the following error.  "LabVIEW:  An exception occured within the external code called by a Call Library Function Node.  This might have corrupted LabVIEW's memory.  Save any work to a new location and restart LabVIEW.  'my vi' was stopped at node 0x0 of subVI "NI_AALBase.lvlib:Real A x B.vi:1".  This error occured after part of the program ran properly.  More specifically, two of the matlab nodes ran perfectly.  I am unsure about the third because the program stopped too early.  I do have to multiply two matrices using the subvi Real A x B.  Is this causing the error?
    I also saw this error when I installed it on another computer.  However I do not see this error when I run the executable or the main vi on my machine  I know there are other discussions on this topic, however I do not know why it would affect some machines and not others.  Also, I do not know why it would work on Friday and not on Monday.  Should I have checked the box that said "Enable Debugging" under the advanced section when building the executable?
    If anyone could help, I would be very appreciative.
    Thanks,
    -Richard

    molecularvisions wrote:
    Good Morning,
    I built a VI that contains Matlab nodes in Labview 8.0.  I made an executable and gave it to a colleage to use who is running Windows XP.  I see in the folder C:\Program Files\National Instruments\Shared\LabVIEW Run-Time that she has 7.1 and 8.0 run time engines installed.
    On Friday the executable ran great on her machine.  Today, when she tried running it I received the following error.  "LabVIEW:  An exception occured within the external code called by a Call Library Function Node.  This might have corrupted LabVIEW's memory.  Save any work to a new location and restart LabVIEW.  'my vi' was stopped at node 0x0 of subVI "NI_AALBase.lvlib:Real A x B.vi:1".  This error occured after part of the program ran properly.  More specifically, two of the matlab nodes ran perfectly.  I am unsure about the third because the program stopped too early.  I do have to multiply two matrices using the subvi Real A x B.  Is this causing the error?
    This is most likely an error with the use of the Call Library Node, but not in the Real A x B.vi itself. This is a VI that comes with LabVIEW and has been tried and tested many times and unless your LabVIEW installation is messed up simply shouldn't fail in such a way on its own.
    However you do include Matlab code somewhere and that might be more likely to cause this. Are you using the built in MathScript node or some other way to communicate directly to a Matlab DLL or such?
    Are you using anywhere Call Library Nodes that you have created or that did at least not come standard with LabVIEW?
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Help to make opencv's dll and LabVIEW's Call Library function node understanding each others

    Hi, i have a little problem trying to use a C++ opencv's dll in labview. I wrote a really simple and stupid dll just to try to understand how it works the call library function node. Here the header code:
    #ifdef GENERICDLL_EXPORTS
    #define GENERICDLL_API __declspec(dllexport)
    #else
    #define GENERICDLL_API __declspec(dllimport)
    #endif
    #include "stdafx.h"
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    #include <iostream>
    #include <string.h>
    #include <stdio.h>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    // Questa classe è esportata da Generic DLL.dll
    class GENERICDLL_API CGenericDLL {
    public:
    int Summ(int a, int b);
    int Sott(int a, int b);
    int opencv(int a);
    // TODO: aggiungere qui i metodi.
     and here the .cpp:
    // Generic DLL.cpp: definisce le funzioni esportate per l'applicazione DLL.
    #include "stdafx.h"
    #include "Generic DLL.h"
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    #include <iostream>
    #include <string.h>
    #include <stdio.h>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    using namespace cv;
    using namespace std;
    // Esempio di variabile esportata
    GENERICDLL_API int nGenericDLL=0;
    // Funzioni esportate.
    GENERICDLL_API int Summ(int a, int b)
    return a+b;
    GENERICDLL_API int Sott(int a, int b)
    return a - b;
    GENERICDLL_API int opencv(int a)
    const string ind = "C:\\Users\\sviluppo\\Desktop\\Tuli.bmp";
    const string ind_2 = "C:\\Users\\sviluppo\\Desktop\\Tuli_Gray.bmp";
    //Mat image;
    return 5;
    i can call all the three simple functions in labview with this easy code. No problem at all. If i uncomment the line "Mat image;" the call library function node doesn't work and i receive the error:
    "The library specified for this node cannot be found or cannot be loaded. Right-click the Call Library Function node and select Configure, then choose the correct library name or path."
    I think that is a problem of dependencies between opencv libraries but i dont know how to manage this. Any ideas?
    Thank you for yours time,
    Francesco.

    Hello Francesco,
    I'm having exactly the same problem as you. I created a DLL that I can easily access from LabView. If I add one line and include "imgproc.hpp" (the only one I need), then LV gives me the same error you had. I read the thread Loura linked to, but I don't see how people actually take care of the dependecies (Klemen's examples did not work for me for the same reason, even though I recompiled the .cpp). Could you explain in detail what you did to make it work?
    Thanks

Maybe you are looking for

  • Close an A/P Reserve Invoice

    Hi, How can I close an A/P Reserve Invoice? It has been posted with 1 item perfectly correct but by mistake with 2 items with quantity of 200 and unit price of 0 (to adjust for total - instead of deleting the lines 2 and 3). Line 2 and 3 of this PO h

  • Get the first and the last date of a week

    Hi all I need to get the first and the last date of a specific week. I need a function that returns two date passing it just one date. The function has to calculate the first and the last date of the week of the argument date. hope to be clear regard

  • Does apple iphone4s wrks with windows xp professional service pack2?

    does apple iphone4s wrks with windows xp professional service pack2? asin the specs its showing service pack or later

  • How to not create duplicates in contacts & calendar on laptop #2

    Ok. I have 2 laptops and someone how here helped me solve the duplicates issues on laptop #1 - it was only happening on the calendar side.  Now i need to synch the same BB on a dif laptop.    I thougth I solved it when on laptop #1 the config is set

  • Is it worth it to keep upgrading Flash?

    It seems like at least once a week, I get a popup to install the newest version of Flash.  You have to close down about three apps for this to install.  I'd rather not do this and completely remove Flash.  Any website using it needs to be deleted fro