create a CVI DLL to be called in LUA

Hi all

I am a user of LabVIEW and LabWindows again. Currently, I have to plan a project that needs to integrate the software into different languages.

The situation is that I have a LabVIEW VI must be integrated into a GUI written in LUA. I'm now thinking is it possible first to convert LabVIEW vi or project first in CVI DLL and call him in LUA. Does anyone have an experince / advice on this? I found that it is possible to use LUA in LabVIEW with LuaView. What about the reverse?

Any pointer will be highly appricated.

See you soon,.

Sparkle

Hello

I'm Ed National Instruments Applications Engineering. I was forwarded your query which I am happy to help you.

In my view, that the following article should provide you with the necessary steps to develop a DLL into a LabVIEW project:

http://digital.NI.com/public.nsf/allkb/A3804F88FCDB1E6286257CE00043C1A7

After which, if LUA is capable of calling C DLL then you should then be able to use the DLL as you would to a C DLL. Of which some research described you may need a module of the stack overflow page that I've also linked below and also a module that is suggested to use on this page of stack overflow:

1. http://stackoverflow.com/questions/2835716/how-do-i-call-functions-inside-c-dll-from-lua

2. http://www.nongnu.org/cinvoke/lua.html

Best regards

Ed

Tags: NI Software

Similar Questions

  • CVI DLL using the reminders of Message Windows

    Background:

    I had a CVI wound around a third-party DLL executable application.  Recently, I've built a few LabView modules and wanted to use the features in the code of the CVI.  I deleted as much as I can from the code of the CVI and built a DLL out of it, so now that it's a call to a third party DLL DLL of CVI.  The third-party DLL uses windows messaging to communicate with the CVI DLL.  I wanted not to re - write the functions already developed in CVI in LabView (much too much effort).

    Problem:

    The problem is windows messaging in CVI uses the InstallWinMsgCallback and binds it to a group of experts.  The events are not processed until you call RunUserInterface(). RunUserInterface does not return. Therefore, any LabView module that loads this DLL crashes, waiting for the DLL back.

    Does anyone develop a CVI DLL, which uses internal reminders, which can be called from an external process?   Anyone have any ideas on how to get around?

    Daniel,

    In fact, I came across the solution even before that you posted.  One thing I noticed however was that it was a little unpredictable when the message would be received.  It turns out that defining the InstallWinMsgCallback to intercept that in_queue worked without needing a processsystem looping events.

    -Bryan

  • I can force a CVI DLL for download with a deployment of labview rt on target project?

    Y at - it a method to force a CVI DLL (referenced via Lib Func call in subVIs) can be unloaded when a labview rt project is deployed to the target, instead of through FTP dll in the RESP folder (System)?  I have clients who do not seem to grasp the concept, and I will provide documentation written for an easier method, as appropriate.

    You include your dll in your project?  If it's in your project, you have the possibility to put the dll in the section still included the build.  It will be in the executable and you shouldn't over ftp.  I've tested this and the dll has been added to the building when I tried it.  Which the dll does not appear in the project?  She is explicitly under the target, or it is under dependencies?

  • Step by step in the cvi dll

    I want to run, step by step in a function that is located in a cvi dll. Is this possible? I did a cvi debug dll that I used in my project of TestStand. But I fail to run step by step inside the function in the dll.

    OK, it works. Thank you very much.

  • Why should I copy of a CVI DLL compiled in the System32 folder?

    Hello

    I've been letting the compiler CVI copy of a DLL (project) in the windows\System32 folder.

    It was mainly to leave more than 1 other executables CVI, installed in different folders under \Program Files\

    Discover and share this code of the DLL.

    In addition, when you build the kit distribution for the DLL, I directed the DLL must be installed in the System32 folder.

    When you introduce this concept in a review to an other software engineers, a mechanic found that the System32 folder should be reserved for windows, hardware drivers, etc.. My CVI DLL needs to reside in the working folder of the executable main partner, or any other location. His concerns were uninstalling and updating process, and if the DLL were at a location specified by the installer, it would be easier to follow, etc..

    I'm assuming that NEITHER recommended CVI to "COPY IN the \Windows\System32 folder. Why?

    Should my fellow engineer some friendly advice?

    [BTW, he used NEITHER CVI occasionally, especially with other languages]

    Thank you ALL

    Scott Youngren with CVI 8.1.x

    Hi Scott,.

    Even if we are aware of them or not, most programs use System32 as their destination of DLL.

    I myself wouldn't mind too much about.

    Have you seen this document?

    You can install to a different location and use the PATH environment variable where you can not convince that system32 is ok.

  • Need to create and add RDM disk while calling reconfigVM

    Hello

    Now I create RDM disk help createdisk method and then added the disk of the virtual machine by using the reconfigvm method using vsphere sdk in c# but I need to create and add the disk while calling the reconfigVM only. I searched and found a code as example.

    diskSpec.operation = VirtualDeviceConfigSpecOperation.add;
    diskSpec.fileOperation = VirtualDeviceConfigSpecFileOperation.create;

    ". According to my understanding, vmdk file can create while adding the LUNs as disk RDM using both add and create function, but then I try these i couldn't succeed. If anyone has tried what can you share your code or suggestions please.

    Thank you

    Vijaya

    Vijaya,

    I guess that how you specify the devicename property is invalid. You just need to assign the devicename you recovered in QueryConfigTarget to the devicename of the backup file.  Please refer below snippet for adding disk:

    Request for more information on specific devices that can be used to back up virtual devices

    CTAR ConfigTarget = cb.getConnection () .getService () .queryConfigTarget (envBrow, hostmor);

    VirtualMachineScsiDiskDeviceInfo [] arrSCSILun = (VirtualMachineScsiDiskDeviceInfo []) ctar.getScsiDisk ();

    HostScsiDisk drive;

    If (arrSCSILun! = null) {}

    for (int i = 0; i)< arrscsilun.length;="" i++)="">

    disc = arrSCSILun [i] .getDisk ();

    If (disk == null) {}

    continue;

    }

    else {}

    deviceName = arrSCSILun [i] .getDisk () .getCanonicalName ();

    }

    Add a disk
    VirtualDeviceConfigSpec diskSpec = new VirtualDeviceConfigSpec();
         
    diskSpec.setFileOperation (VirtualDeviceConfigSpecFileOperation.create);
    diskSpec.setOperation (VirtualDeviceConfigSpecOperation.add);
         
    VirtualDisk disk = new VirtualDisk();
    VirtualDiskRawDiskMappingVer1BackingInfo diskfileBacking = new VirtualDiskRawDiskMappingVer1BackingInfo();
         
    diskfileBacking.setFileName("");
    diskfileBacking.setDiskMode ("persist");
    diskfileBacking.setCompatibilityMode ("physicalMode");
       diskfileBacking.setDeviceName (deviceName); It's the devicename you got above
    System.out.println ("DeviceName assigned is" + deviceName);
    disk.setKey (new Integer(-101));
    disk.setControllerKey (new Integer (diskCtlrKey));
    disk.setUnitNumber (new Integer (0));
    disk.setBacking (diskfileBacking);
    disk.setCapacityInKB (1024);
         
    diskSpec.setDevice (disk);

    And to set the loglevel, please visit: http://kb.vmware.com/kb/1001457

  • Component ActiveX cannot create object wrong when VB script call a dll

    Hello

    I'm new to VB and .NET. We have a SQL job in our application (developed by someone else) hosted on Win Server 2003, who calls the VB script and this script inturns calls a DLL.

    When I run this job, I get the error - component ActiveX cannot create object.

    I tried to print the source of the error (by Err.Source and it gives me 'Microsoft VBScript runtime error').

    Any help would be appreciated. Let me know if I could extract more information.

    Thanks in advance.
    ME

    Hi SenLady,

    The question you have posted here is related to Visual Basic and would be better suited on MSDN forum. I suggest you post your question on the following link.

    http://social.msdn.Microsoft.com/forums/en-us/categories

  • Conversion/appeal of an application created with CVI in Labview

    Hello

    I have a third-party application code created with labwindows CVI (attachment: scissor lift CVI code.rar) which is used for our control of movement of CT scans. I want to serve the Labview 8.6 my main software for data acquisition and software interface for my development. My idea is to create a dll from this CVI code and called the dll with Labview library import function is shared.

    My problem is that I am no expert in CVI programming if anyone can help me how to create a dll from this code? or any other suggestions to implement this conversion?

    Code CVI attached for reference.

    Thank you

    Lojius

    A starting point can be found here

  • How to get the result of the test of CVI DLLs in teststand!

    I write a driver dll to test a source, I want to get the tension of world SERVERS (the instrument of the RS) and I used to call DLLs that written by CVI, teststand

    My question is what is the best way I can get the result of the test and show the user to teststand. the code below is fair? When I used to call this dll document, teststand

    "" I just get the result by setting in TS.this is a good meathod, and what should you do in teststand, I put the "outputVoltageV" point to an object?

    /*===========================================================================*/
    / * Function: read voltage/current output * /.
    / * End: this function returns the output and actual output voltage * /.
    / * current instrument.                                      */
    /*===========================================================================*/
    ViStatus _VI_FUNC rsngsm_datReadOutput (ViSession instrSession,
    ViPReal64 outputVoltageV, ViPReal64 outputCurrentA, ViPBoolean statusPeakCurrent)
    {
    ViStatus rsngsm_status = VI_SUCCESS;
    Bruno buf [BUFFER_SIZE];
    ViInt32 retCnt;
       
    FMT (buf, "%s<>
    If ((rsngsm_status = viWrite (instrSession, buf, NumFmtdBytes (), & retCnt))<>
    Return rsngsm_status;
           
    If ((rsngsm_status = viRead (instrSession, buf, 50, & retCnt))<>
    Return rsngsm_status;
    If (Scan (buf, "%s > %f [p2];")) %f [p2]; %i [b2] ", outputVoltageV, outputCurrentA, statusPeakCurrent). = 3)
    Return rsngsm_status;
           
    Return rsngsm_status;
    }

    sean_tan,

    Yes, you just pass a value of digital TestStand (e.g.; locals.number).

    If you use the adapter of the ICB, it might make more sense that you can use the Flexible DLL adapter for this type of function, that you do not use the standard settings of tTestData and tTestError. While TestStand will correctly recognize the function prototype, you want to make sure you that include the type library of your function Panel (you will need to create one if you have not already done so) in settings target of LabWindows / CVI-> type library.

    I hope this helps.

    -Jack

  • DLL in CVI2013 call

    Sorry for this question but I'm not very familiar with the external DLL...

    I have an older code where I used

    empty typedef (__stdcall * fp_SPNDLdllTYPE) (double *, double *, double *, double * long *, char *, long);

    I need it to assign the address of a function in the DLL using LoadLibrary and GetProcAddress.

    Everything was going well until I recompiled the code with CVI2013, .the obtained address now is zero...?

    Given that the compiler has changed, I have tried the two default calling conventions in the Build options, but it did not help...

    What should I change? Thank you!

    I would like to once again thank you to you all my apologies for this off-topic... It turns out that the issue is not related to CVI, is the dll that had changed...

    I was told that, in the last version, the missing subroutine has been divided in two pieces (with different names, of course)...

  • create string handle dll

    Hey everybody,

    I am learning to the LabView with a DLL interface, which uses Manager to create types in LabView. Currently, I want to return only a string of characters chosen from an array of strings passed to LabView. In this test, I want to explicitly create a new string in the external code. So, I created the following C++ code:

    void element(TD1Hdl list, int32_t index, LStrHandle *element) { LStrHandle h = (*list)->elt[index];
    
      // maybe resize instead of create new?    LStrHandle newHandle = (LStrHandle)DSNewHandle(sizeof(int32) + (*h)->cnt); (*newHandle)->cnt = (*h)->cnt;
    
        MoveBlock((*h)->str, (*newHandle)->str, (*h)->cnt);  (*element) = newHandle;}
    

    Note the pointer over the handle, and I assign him in the end. I plugged it as below:

    Note that nothing happens in the 3rd parameter.

    now my question is:

    -Is it possible? What is LabView with the 3rd parameter (pointer to pass to manage being NULL or create by default)?

    -Is my C code that is safe (in addition to being able to specify an index that does not exist).

    Thanks in advance!

    Vincent

    The leak memory occurred if you can run the following code:

    So, in this case, you should check if handle already exists, don't create news, but only want to resize it.

    In general, you should create new usually handles for elemenths table (if your items in the array are strings or clusters, but not numeric values - there special function for resizing digital paintings).

    As I understand, you do not need to free these handles, because LabVIEW will do it for you (in any case, you can check easily - just run your code in the cycle and check the memory usage).

    But personally, I felt a little dangerous to call DSNewHandle without DSDisposeHandle. Probably you can play with DSCheckHandle before DSCreateHandle, or use DSCopyHandle for trasferring new created/resized table to the destination, then you can release your temporary created handle.

    Note, National Instruments shows help following: «...» "When returning a new array from a DLL, you must allocate memory for the array in LabVIEW. To do this, the easiest method is to enter a picture of a known length in the node to call a library function that is at least as large as the resulting array expected returned by the DLL... »

    and then the example of NEITHER:

    Andrey.

  • a dll Win32 winspool call for the issue of the printer status

    Hello

    I apologize because I do not understand Win32.

    I for 2014 LabVIEW full development system and want to access the Win32 API.

    I am trying to write a function to determine if a printer is out of ink or offline for some reason any.

    I see that the MSDN Winspool library has the features I need.

    According to the MSDN Web site, the dll is Winspool.drv.

    https://msdn.Microsoft.com/en-us/library/Windows/desktop/dd162751 (v = vs. 85) .aspx

    I tried to do a call library function in LabVIEW, but it is the search for DLL and does not recognize the Winspool.drv

    It lie in the methods in LabVIEW to access the Winspool, or nobody knows what the correct dll (and location) I call is?

    Ultimately, what I want to do is open printer-> get jobs-> status of--> close printer.

    Seems simple enough.

    Thanks in advance for any advice.

    You use a 32-bit version or 64-bit LabVIEW? If you use the 32-bit version, you should not try to load the 64-bit version of the DLL. Surprisingly, the System32 directory is for 64-bit dll, and the SysWOW64 folder is for 32-bit dll. If you have installed the 32-bit version of LabVIEW, try SysWOW64 winspool.drv.

  • CVI 2013 SP1 - function calls repeated with pointer on a variable array parameter causes a shift of the index

    I have some functions will be pointers as parameter and CVI 2012 SP1, they work as before without problems but with CVI 2013 SP1 they are now incorrect.

    Here the description of what is happening - I found a cure, but a duty adopt the old code and I think it's clear that nobody don't "captures" all lines in a 'big old code' which are affected (maybe):

    I have functions

    'function_XYZ(int *p_paraArr) '.

    with 'p_paraArr' as pointers on a table (int).

    Suppose I have another function

    "fct_TOP (void)".

    where is a local array variable which is inizialized by

    "int TheArray [25] = {0};

    and inside of this "TOP"-function-body I call a function ".

    "function_XYZ (TheArray).

    There are no complains of the compiler (CVI 2012 or 2013) and the code works (but the CVI 2013 only once!).

    But if I put 'fct_TOP' loop I have a lag in the "TheArray' -memory.  (The loop surrounds the function "TOP"! "")

    This means that the result "TheArray" obtained from "function_XYZ (TheArray)" starts at index '1' not on the index '0' - as the first time that the function "function_XYZ (TheArray)" was performed. ".

    The solution is:

    I only replaced

    "function_XYZ (TheArray)" (<1>)

    by

    "function_XYZ (&(TheArray[0]))" (<2>)

    overall the program now works every time (in the whole loop)-the first time (in the loop).

    In the second version (<2>) everything is necessary to "work well":

    The '&' and parentheses "(...)", which contains the element that may be designated by the '& '.

    And I hope that you believe me: I've tested several times, it was only "little" change that solved the problem.

    So it seems that the ICB 2013 (SP1) is a kind of internal offset index by a repeated execution of the

    "function_XYZ (TheArray).

    but I don't know how or why but I see in debug mode by observing the expected against the values in the table received!

    At the first time the (implicit) internal index of 'TheArray' is '0', but the following times (during the execution of the loop) the internal index passes to '1' (seen in the debugger because that all the expected values were shiftet like that!).

    So there's an explicit index in the table ("function_XYZ (&(TheArray[0]))") necessary to make the first time of this clear code execution.

    There are some good improvements in 2013 CVI (SP1) and I like this environment more than the 2012 version - but:

    There are other "changes" also, in the compiler (or linker...?) that are more rigid than "in ancient times.

    The problem of this kind of error is always the 'old code '!

    It is expected of such behavior.

    The compiler/linker do not complain (a complaint would be good!) writing but he made this mistake (in a loop).

    By the way: my 'compilation Options' are set to 'Extended' (without change in the "..." ("- button - Options) and that all of the boxes, except the" OpenMP_support "-box are checked!"» So I think that I put the very rigid compiler - maybe there are some «...» ' - button - settings to get rid of this problem, but I have not found them/it.

    My request:

    -Check the stiffer compiler by the need of an explicit index

    - or switch to the 'old' behavior with "function_XYZ (TheArray)" always refers to implicit index '0' of the element "TheArray". "."

    Thank you for your messages, comments and suggestions.

    -As I wrote before - maybe it's the style of programming or error"self made"... maybe...
    .. But if I replace 'function_XYZ (TheArray)' by "function_XYZ (&(TheArray[0]))" and
    then it works... Why so and not, if bothe the same? ...

    But as long as I do not post sample code, nobody is going to accept - I accept it. So consider this post more as an allusion to the fact that of the LW/CVI 2012-2013 LW/CVI more changed than just the LW - GUI or certain features: the compiler changed its 'way to'... or almost.

    For this problem, I think that I will use the solution 'use no implicit and explicit pointers'.
    Who should be a good idea taking into account
        http://forums.NI.com/T5/LabWindows-CVI/fatal-run-time-error-dereference-of-out-of-bounds-pointer/TD-...

    mybe also only caused by wrong code... who knows... but for me it is a sufficient reason to act as I suggest above.

    Best regards,
    F.

  • Create a directory tree: how to call a global function from inside a for loop

    Hello

    I am trying to create a workflow that will create a directory tree in vCenter.

    Concept:

    Basically, I am trying to execute nested for loops for each level of the tree to the caller a global tree.

    Problem:

    The 1st loop for works and creates the file 'Dev '.  The second loop for does not work with error message:

    [19:16:16.219 2013-06-27] [I] building Dev folder
    [19:16:16.474 2013-06-27] [I] directory Built: Dev
    [19:16:16.476 2013-06-27] [I] the records building servers
    [19:16:16.480 2013-06-27] [I] TypeError: cannot find the createFolder function in dev object. (Workflow: TEST_TNG_New_Site_Folder_Structure / Scriptable task (item2) #36)

    I think it has to do with JavaScript not being not able to call a global function in a nested object (I'm not a programmer and don't know JavaScript, so don't shoot me on that :)

    Code: (will clean this up once I do work)

    var folderBase is ['Dev', 'DMZ', 'Prod', 'UAT'];.

    var folderT1 = ["servers", "Jobs"];

    var folderT2 = ['Window', 'Linux'];

    var folderT3 is ["Repo2', 'Repo3', 'Repo1', 'Repo4'];.

    var folderT4 is ["T1", "T2", "T3"];.

    Create the files folderBase level

    for (var i = 0, l = folderBase.length; i < l; i ++) {}

    var rootFolder = parentFolder;

    buildFolderTree (folderBase [i]);

    Create the files folderT1 level

    for (var j = 0, l = folderT1.length; j < l; j ++) {}

    var rootFolder = folderBase [i];

    buildFolderTree (folderT1 [j]);

    Create the files folderT2 level

    for (var k = 0, l = folderT2.length; k < l; k ++) {}

    var rootFolder = folderT1 [j];

    buildFolderTree (folderT2 [k]);

    Create the files folderT3 level

    for (var x = 0, l = folderT3.length; x < l; x ++) {}

    var rootFolder = folderT2 [k];

    buildFolderTree (folderT3 [x]);

    Create the files folderT4 level

    for (var y = 0, l = folderT4.length; y < l; y ++) {}

    var rootFolder = folderT3 [x];

    buildFolderTree(folderT4[y]);

    }

    }

    }

    }

    }

    function buildFolderTree (folderName) {}

    System.log ("Building folder" + folderName);

    rootFolder.createFolder (folderName);

    System.log ("directory of frame:" + folderName);

    }

    Any help will be appreciated.

    Thank you

    B

    Hello

    The createFolder() method returns the object VcFolder to the folder just created, for the new file to be used immediately.  Here is how I modified the code:

    Create the files folderBase level
    for (var i = 0; i)
    var newBaseFolder = buildFolderTree (parentFolder, folderBase [i]);
    Create the files folderT1 level
    for (var j = 0; j)
    var newT1Folder = buildFolderTree (newBaseFolder, folderT1 [j]);
    Create the files folderT2 level
    for (var k = 0; k)
    var newT2Folder = buildFolderTree (newT1Folder, folderT2 [k]);
    Create the files folderT3 level
    for (var x = 0; x)
    var newT3Folder = buildFolderTree (newT2Folder, folderT3 [x]);
    Create the files folderT4 level
    for (var y = 0; y)
    var newT4Folder = buildFolderTree (newT3Folder, folderT4 [y]);
    }
    }
    }
    }
    }

    function buildFolderTree (parentFolderObj, folder_name) {}
    System.log ("Building folder" + folderName);
    var newFolder = parentFolderObj.createFolder (folderName);
    System.log ("directory of frame:" + folderName);
    return NewFolder;
    }

  • That one is the best way create a parameter to use to call report

    Designer/forms have the ability to create a form with no linked items (columns of data inot according to) with lov to reports...

    How can I do this with adf bc, jdeveloper.

    Thank you

    If you don't need the database interaction you do not have to use the ADF BC for your reports calling.
    It would be simpler just to write a simple Java class that has a method that accepts parameters and call reports - then you can expose it as a data control and link to your JSF pages.
    Here is a basic example of how to work with a simple class in service data control:
    http://blogs.Oracle.com/Shay/2009/07/java_class_data_control_and_ad.html

Maybe you are looking for