How do I pass a 1D LabView array as a pointer to an array in a C DLL?

Hello,
I am trying to pass a 1D Labview array of DOUBLE to a C DLL which is expecting a pointer to an array of DOUBLE.  I have read that LabView stores arrays as a pointer to a pointer and that the first element of a LabView array is actually the size of the array.  So I think my question is then how do I dereference the first pointer and pass in a pointer which points to the second element in the array?    
Any thoughts out there?
Thanks!

Hi justyou,
There are many, many resources on this topic, so I will guide you to the two most useful ones:
The "Call DLL.vi" example that ships with LabVIEW explains how to use almost any data type when executing DLLs. The "Call DLL.vi" can be found by browsing the Example Finder.
Integrating DLLs. This page is the portal for DLL interation related resources. Read the tutorials and try the examples...
This should give you some ideas.
Have fun!
- Philip Courtois, Thinkbot Solutions

Similar Messages

  • How can i pass a value in array into .setText()?

    i want to display a value in an array into a JTextField. May i know how to do it?
    eg:
    JTextField UserName;
    UserName.setText(s);
    but it doesn't display the value into the JTextfield.

    ok... is s an array?
    String[] s = {"s1", "s2"};Either you expect 1 value...
    username.setText(s[0]);
    // or
    username.setText(s[1]);Or you expect both:
    StringBuffer sb = new StringBuffer("");
    for(int x = 0; x < s.length; x++) {
       if(x != 0) sb.append(", ");
       sb.append(s[x])
    username.setText(sb.toString());

  • How do I pass an array of strings? (Help Me... Please!!! .Read Me....)

    Dear All.
    Help Me...
    English is not very good. Google translator is used.
     How do I pass an array of strings?
    Please refer to the VB program
     ===========================================
    Private Sub m_btn_Click()
        Dim nReturn As Long
        Dim sPpid As String
        Dim sMdln As String
        Dim sSoftRev As String
        Dim nCount As Long
        Dim saCCodes(2) As String
        Dim naPCount(2) As Long
        Dim saPNames(10) As String
        sPpid = "PPID001"
        sMdln = "Mdln"
        sSoftRev = "Rev001"
        nCount = 2
        saCCodes(0) = "1"
        naPCount(0) = 5
        saPNames(0) = "Param001"
        saPNames(1) = "Param002"
        saPNames(2) = "Param003"
        saPNames(3) = "Param004"
        saPNames(4) = "Param005"
        saCCodes(1) = "2"
        naPCount(1) = 5
        saPNames(5) = "Param006"
        saPNames(6) = "Param007"
        saPNames(7) = "Param008"
        saPNames(8) = "Param009"
        saPNames(9) = "Param010"
        nReturn = m_XGem.GEMReqSend(sPpid, sMdln, sSoftRev, nCount, saCCodes(0), naPCount(0), saPNames(0))
        If (nReturn = 0) Then
            Call Me.AddMessage("[EQ ==> XGEM] GEMReqSend successfully")
        Else
            Call Me.AddMessage("[EQ ==> XGEM] Fail to GEMReqSend (" & nReturn & ")")
        End If
    End Sub
    =================================================
    nCount, naPCount enough saCCodes, saPNames value must be sent.
    How to handle an array of strings in LabView is impatient.
    I want to VB program implemented in LabView.

    Have you actually tried to right click on the according node parameter and select Create->Constant or Create-Control??
    And I don't see any string array in the parameter list. That are all simple strings and the VB code in your first post clearly shows that the call to the function only indexes the first element of those arrays to be passed to the function, not the entire array.
    If the function really reads arrays despite being declared as only taking strings then it is using some weirdo VB trickery and there will be no way to replicate that in LabVIEW.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How can I pass an empty array to a parameter of type PLSQLAssociativeArray

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

  • How do you pass an ActiveX Variant from an external application to LabVIEW?

    Background: I created a LabVIEW ActiveX server. I can access it with my external application (Matlab). I have a control variable in my LabVIEW executable. I want to use Active X to set the value of my control variable from my external application.
    Documentation: The only reference in the documentation for this task is in the Using ActiveX with LabVIEW in the LabVIEW 2009 help. It simply says "Use the variant control and indicator to pass data to or from ActiveX controls." I also went through all the ActiveX examples in the example finder and did not find any vis that passed variables using ActiveX.
    Questions:
    What should my control variable look like in LabVIEW? Should it be a refnum, a variant, or a data type? Does it have to be wired to a vi connector?
    Do I need to do any magic on this variable, such as change its properties?
    How do I pass the value from my external application to the variable in my LabVIEW executable?
    Thank you.

    Hello Lyn,
     The control variable should be a refnum and it would have to be wired to Automation Open with the correct reference.
    Here are some great examples of using ActiveX Server in LabVIEW
    LabVIEW Executable Used as ActiveX Server in LabVIEW
    http://decibel.ni.com/content/docs/DOC-9647
     Calling ActiveX Code from LabVIEW
     http://decibel.ni.com/content/docs/DOC-9073
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • If i load 1GB file in labview array, it shows memory full. How tom handle it?

    if i load 1GB file in labview array, it shows memory full. How tom handle it?

    Don't read it all at once.  Just read the parts you need when you need it.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I'm new to the LabView. How do I pass data from VI configured using Serial (CMTS using CLI commands to set Parameters ) to VI configured using GPIB(vecto​r signal analyzer ) to measure such as RF frequency or power on the instrument​? Thanks

    I'm new to the LabView. How do I pass data from VI configured using Serial (CMTS using CLI commands to set Parameters ) to VI configured using GPIB(vector signal analyzer ) to measure such as RF frequency or power on the instrument?
    I just want to set something on the front panel that will execute the Serial parameters first and then pass these settings to vector signal analyzer
    Thanks
    Phong

    You transfer data with wires.
    Frankly, I'm a little confused by your question. I can't think of any reason why you would want to pass serial parameters (i.e. baud rate, parity) to a GPIB instrument. Please explain with further detail and attach the code.

  • How do I pass a void *pointer to a dll in LabView

    I did read previous posts on the matter and tried just about everything, inlcuding defining the pointer as a U32 int.
    What I am trying to do is program FLASH using WindRiver VisionPROBE EST...
    I do have some sucesses... )
    I can open a connection to the EST, initialize it, start & stop the target. No problem here..
    Here are some additional details:
    I can't read memory, write to the target register or program the FLASH, yet. Any advice on how to get further with this? Typically, when doing this using WR's visionClick sw, we need to use a register file which sets up the target. I have not seen any reference to this in their API.
    I can convert to CVI if necessary. I am using the dll's from WindRi
    ver. I'd prefer keeping everything in LV, but LW-CVI is fine.
    My problem is that I am not sure if I am passing void pointers back & forth correctly. For instance, I need to call a function which returns a status, as follows:
    status = EST_WriteTargetRegister (long handle, Unsign int register, void * value)
    How do I pass the "void * value" to the input of a Call Library FUnction Node. I did try "Adapt to type" which does give a "void * value", and I tried both "Handles by Value" & "Pointers to Handles".
    When I change the input value to anything other than "Adpapt To Type", I get a violation error. >(
    Has anyone successfully automated WindRiver's EST?
    - Thanks -
    JLV"

    Hi,
    Have you tried passing a I32, but selecting "Pointer To Value"?
    Is there any description about the "void *pointer"? Could it be a callback
    function?
    Regards,
    Wiebe.
    "JoeLabView" wrote in message
    news:[email protected]..
    > I did read previous posts on the matter and tried just about
    > everything, inlcuding defining the pointer as a U32 int.
    >
    > What I am trying to do is program FLASH using WindRiver VisionPROBE
    > EST...
    >
    > I do have some sucesses... )
    > I can open a connection to the EST, initialize it, start & stop the
    > target. No problem here..
    >
    > Here are some additional details:
    >
    >
    >
    >
    > I can't read memory, write to the target register or program the
    > FLASH, yet. Any advice on how to get f
    urther with this? Typically,
    > when doing this using WR's visionClick sw, we need to use a register
    > file which sets up the target. I have not seen any reference to this
    > in their API.
    >
    > I can convert to CVI if necessary. I am using the dll's from
    > WindRiver. I'd prefer keeping everything in LV, but LW-CVI is fine.
    >
    > My problem is that I am not sure if I am passing void pointers back &
    > forth correctly. For instance, I need to call a function which
    > returns a status, as follows:
    >
    >
    > status = EST_WriteTargetRegister (long handle, Unsign int register,
    > void * value)
    >
    >
    > How do I pass the "void * value" to the input of a Call Library
    > FUnction Node. I did try "Adapt to type" which does give a "void *
    > value", and I tried both "Handles by Value" & "Pointers to Handles".
    >
    > When I change the input value to anything other than "Adpapt To Type",
    > I get a violation error. >(
    >
    > Has anyone successfully automated WindRiver's EST?
    >
    > - Thanks -
    >
    > JLV"

  • In TestStand, How do I pass variables to a sequence, other than the standard Input Buffer?

    I have Labview VIs that have arrays as inputs, I want to pass information in that array to the VI. TestStand already has the Input Buffer setup, but how do I create more input buffers, like array input buffers?? I know that the "Parameters" section in the sequence file is for passing info to subsequences, but that does not help me, Thank you in advance!!

    See the TestStand shipping example located in the directory \Examples\AccessingArrays\UsingLabVIEW. This will show you how to pass arrays back and forth from a VI to a sequence variable.
    If you are trying to create a step that handles arrays, then you will need to create a new step type that has an array step property. There is an example on the NI web site of a step type that handles arrays. Go to www.ni.com/support and search the Examples Program database using the search string of:
    +"step type" +waveform +teststand

  • Who knows how to output some text once labview detects something I want using pattern matching(V​ision assistant)​?

    who knows how to output some text once labview detects something I want using pattern matching(Vision assistant)?
    The text is something like"Yes, this is a coin"
    Thanks!

    I attached a SubVI which I used to place an overlay next to a Pattern, found by a Pattern Match before:
    As you can see, you simply pass the image reference and the Array of Matches to the VI along with the String you want to have as an overlay next to the Match.
    I also modified your VI a bit, but didn't test it. I created an Array of clusters, each elment containing the template path along with the respective text.
    Please note that this is just a hint!
    Christian
    Attachments:
    suggestion.vi ‏146 KB
    Overlay_Txt.vi ‏24 KB

  • Passing files into labview vi by opening the file

    I have a labview exe that is installed on XP that can create/save files with an extension not recognized by windows. The files can be opened from within the exe but what I want is to double click(open) the file from explorer/desktop and have it opened in my vi. I know how to associate the file with windows so opening it will open the exe, but how do I pass this argument into my exe so my app can use it?

    Us the "Application:command line" property, see attached code image.
    When building the application, make sure to check "Pass all command line arguments to application" in the builder.
    When your associated file is double-clicked, the application will open and have the file name of the double-clicked file as second element (#1) in the commandline array. (You can also drop any file on the application in explorer and it will open with the dropped file name in that position.)
    Also check the online help under index: "Command Line Arguments (Application property)"
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    commandline.gif ‏3 KB

  • Pointer to LabVIEW Array

    LabVIEW memory management question:
    Question Part 1: When I write a C .dll that takes a LabVIEW array,
    LabVIEW passes a pointer into LabVIEW's memory to the array to C. 
    Can C return the pointer to me (e.g., not the array I passed in, but
    it's memory location)?
    i.e.: void GetNativeMemoryPointer(float *pointer, float *array);
    where *array is my input array, and GetNativeMemoryPointer returns the pointer to this array on *pointer.
    Question Part 2: What issues will I run in to if I pass this returned
    pointer to another .dll call.  What if this .dll call is in
    .NET? 
    Concerns: How does LabVIEW hold this array in memory?  When I call
    GetNativeMemoryPointer, does LabVIEW make a copy and send this a
    pointer to the copy to the dll, or is the pointer to the
    original?  Will LabVIEW ever "move" the original, e.g., will my
    pointer become invalid after some time?
    Joe Gerhardstein
    Averna Test Systems
    Certified LabVIEW Architect
    http://www.averna.com

    Part 1: I must confess that I don't understand your question. Pointers and arrays are very closely related in C so I'm not following the sequence. So I don't know if the following applies, but here is a possible answer...
    The pointer to a LV array that is passed to a call library node is valid ONLY during that call. Once the call to the DLL completes, you should consider that pointer value invalid. You can, of course, make a copy of the array and return a pointer to your copy - but LV won't know what it is. It definately won't show up in LV as an array. However, you can pass that pointer to the copy around to other DLLs as much as you want.
    * Don't forget to free the copy. If you make a copy of the array, you own it - therefore you must free the memory of the copy at some point *
    Part 2: Easier to answer.
    * If you want LV to convert your pointer to a LV data type (such as a LV array): Take a look at page 2-4 in the "Using External Code in LabVIEW". In almost all cases we do not support pointers. The only exceptions are the ones shown in the Call Library Node configuration. For arrays, notice that if you want to return an array to LV, we have our own defined data types for this - read up on the CIN section for more information.
    * If you want to return a pointer than LV just messages to other DLLs: No problem. Put the parameter to the routine as a pointer to integer (or a return value of type int). Thus your pointer is an integer as far as LV is concerned. When you pass it to another DLL, we'll pass the exact same value to the DLL - thus the pointer is never modified or the data touched.
    Did this help?
    Message Edited by Lycangeek on 08-10-2005 02:12 PM
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • How can I pass the adress of a cluster to a dll

    Hi,
    I need to pass the adress of the struct(cluster) below from labview 7.1 to a dll written in C++.
    Can anyone help ?
    typedef struct
    unsigned char DPV1_Supported;
    unsigned char Max_Channel_Data_Length;
    unsigned char Extra_Alarm_SAP;
    unsigned int C1_Response_Timeout;
    unsigned char NormParameters [7];
    unsigned char UserParamLength;
    unsigned char UserParameters [248];
    unsigned char ConfigLength;
    unsigned char Configuration [256];
    unsigned char OutputLength;
    unsigned char OutputData [256];
    unsigned char InputLength;
    unsigned char InputData [256];
    unsigned char NormDiagnosis [6];
    unsigned char UserDiagLength;
    unsigned char UserDiagnosis [256];
    BOOL bCommunicate;
    BOOL bOperate;
    BOOL bNewDiag;
    } DP_DATA;
    Thanks,
    Andreas

    Can you explain me the difference between LabView arrays and C arrays more detailed.
    A C array of THINGs is a pointer to a THING. The THING is followed in memory by another THING, etc., etc.
    There is no difference between a pointer to a THING and an array of THINGs, (except the expectation of the user is that the array contains more than one THING). But physically, they are both pointers to a THING.
    In C, if you pass an array to some function which operates on it, you also have to have some convention to separately pass the number of items in the array. The array itself has no way of indicating its own size. A C string is terminated by a null byte - that's one way. Other functions require you to pass a separate parameter to indicate how many elements are in the array.
    A LabVIEW array is a different beast. It is a HANDLE, not a pointer. When you resolve the handle, you interpret the first 4 bytes as an I32 with the current dimension size in it. If you have a 2-D array, you interpret the first TWO I32s as the current dimension size. If you have a 3-D array, you interpret the first THREE I32s, etc. etc.
    Immediately after the dimension size(s), follows the data itself.
    Read this for the official explanation. It's a good idea to print this out and keep it around.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/370DFC6FD19B318C86256A33006BFB78?opendocument target=_blank
    Why I can't put an array inside a cluster
    I didn't mean to imply that you can't do that. You can. LabVIEW will handle it correctly. But you can't pass the cluster to C and have it understood, using ordinary C array declarations.
    It's legal in LabVIEW to have a cluster with an I32 followed by an array of DBLs, for example.
    But if you pass that thing to a DLL or CIN, what gets passed is a pointer to an 8-byte chunk of memory.
    The first four bytes are the I32 value. The second four bytes are a HANDLE to the array data. The handle points to a pointer, the pointer points to a chunk of memory, the first four bytes of that chunk are the dimension size.
    The bottom line is you can't treat it as an array in LabVIEW, and also as an array in C.
    You have three choices:
    1... Change the C code to understand LabVIEW arrays. There are lots of library tools to help you deal with LabVIEW arrays.
    2... Change the LabVIEW code to fake the structure that C requires. If you have an array of 256 Bytes, you'll have to fake that with a CLUSTER of 256 U8s. If you have an array declared as int[123]. you'll have to make a CLUSTER of 123 I32s. You can make the data fit the C declaration, but you have to study the details.
    3... Duplicate the functionality of your C code in LabVIEW.
    Hope that helps.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers? (history data from a chart)

    Hello,
    in my vi I have a chart with 5 Plots displaying measurement data.
    The user should be able to save all the history data from the chart at anytime. (e.g. the user watches the chart and some event happens, then he presses a "save"-button)
    I know, that I can read out the history data with a property node. That is not the problem. The problem is, how do I handle the data? The type of the history data is a 1-D array of cluster of 5 elements.
    I have to convert that data somehow into a 2 D-array of numbers or strings, so that I can easily save it in a text-file.
    How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers?
    I use LabVIEW 7.1
    Johannes
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Solved!
    Go to Solution.

    Gerd,
    thank you for the quick response and the easy solution.
    Look what I did in the meantime. I solved the problem too, but muuuch more complicate :-)
    And I have converted the numbers to strings, so that I can easily write them into a spreasheet file.
    Johannes
    Message Edited by johanneshoer on 04-28-2009 10:39 AM
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    SaveChartHistory.JPG ‏57 KB
    SaveChartHistory.JPG ‏57 KB

  • How to store logical operator in an array in java

    how to store logical operator in an array in java.
    Array should not be String type if i pass an element of that array it should be considered as logical operator

    my exact requirment is like this, i need some logic
    to convert string like this "2 Equals 3 AND 4 greater
    than 7" to condition like this
    2 == 3 && 4 >7 which i can pass to if
    condition.So you want to create an expression parser?
    No need for something as ugly as what you think you need, a simple nested conditional will do it for just the few logical operations.

Maybe you are looking for

  • Operations in ALV

    Hi,    i want to perform some operations on my ALV Columns. for eg, i want to add the contents of column1 to the contents of column2 and store the result in column3 how can i do this in ALV? i've made these columns editable.

  • How to run MRP for BOM as well as ROL items

    We have only one plant. I  want to run MRP for BOM items as well as ROL items.  MRP can be  run plant wise thru tcode MD01.  I want to run mrp for only ROL items. Please suggest Regards, ( Rajneesh Gulati ) Edited by: Rajneesh  Gulati on Jun 20, 2008

  • Do you need to have a WIfi Connection to Play iTunes Match on your iPod?

    i just purchased iTunes Match for my iPod touch and iPad2 however im not sure if it will work off of a wifi network? i hope so!

  • Reports6i and WebDB

    I installed reports 6i and ran patch scripts on webdb user. 1. @$ORACLE_HOME\report60\server\security\rwwwvins.sql 2. @$ORACLE_HOME\report60\server\security\rwenable.sql (Before running i updated script rwinswiz.sql and fixed bug so that all scripts

  • PLS-00357

    Hai I created sequence create sequence emp_seq startwith 800 increment by 1 maxvalues 1000; and emp table is empty.I want to set module information into v$session by dbms_application_info package.According to that i created procedure sucessufully ,i