Pass array to "Labview 7" DLL in Visual Basic

Hi!
I would like to pass arrays in Visual Basic to a LV DLL made in Labview 7.
I've seen the examples of NI to create a dll in Labview for Visual Basic and for passing arrays, but all the examples were made with Labview 6.
The problem is that in the tutorial they say to define the Pass By of the argument as Array Data Pointer, but in Labview 7 when I add an array as an argument I don't have that option.. It's always defined as TD1Hdl* inArray, and in Labview 6 it was defined as float64 inArray[].
Can I use the TD1Hdl structure in Visual Basic? How do I use it?
Thanks!

Unfortunately, i'm not expert in Visual Basic, i need to investigate in your problem.
See link below, that explain how you can use LabVIEW DLL in Visual Basic.
http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_answer=&p_guid=B45EACE3D9E556A4E034080...
http://forums.ni.com/ni/board/message?board.id=170&message.id=100151&requireLogin=False
http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&4303F9807BFE234486256906007259EF
Regards,
Christophe S.
FSE East of France І Certified LabVIEW Associate Developer І National Instruments France

Similar Messages

  • Communicate with a USB port, DLL in Visual Basic, program in LabVIEW

    Hello !
    I have to write a program in LabVIEW (I'm a novice in this language) to communicate with an interferometer via an USB port. The drivers and DLL for the USB port are written in Visual Basic.
    -I don't know if it's possible to use them just so, or if I need to adapt them to LabVIEW.
    -And how to do to call a particular function of my DLL ?
    Thank you for your answer...
    Gaelle

    Nakaose,
    You should refer to these links:
    Tutorial: Sharing code with VB:
    ==>  http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&5F9B8F1FF859549186256E5C0005457D
    Tutorial: Can LabVIEW C?:
    ==> http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&FD4B480C24A159BD86256E60005B0120
    Best regards,
    JPR
    NIF

  • Pass Cluster into LabVIEW Generated DLL using __cdecl

    I'm using a DLL generated with LabVIEW 7.1 to calculate IIR filter coefficients in a application I'm writing in C++. The DLL contains several different functions. The function prototype in question looks like this:
    long __cdecl ButterworthCoefficients(unsigned long filterType,
    double samplingFreqFs, long order, double lowCutoffFreqFl,
    double highCutoffFreqFh, TD1 *IIRFilterCluster);
    where "TD1" is an output that contains the IIR filter coefficients generated by the function. TD1 looks like this:
    typedef struct {
    unsigned long filterStructure;
    TD2Hdl ReverseCoefficients;
    TD2Hdl ForwardCoefficients;
    } TD1;
    TD2Hdl is a handle to a 1-D array containing doubles.
    My question relates to how to pass the TD1* parameter into the function. If I simply declare TD1 and leave it uninitialized and pass it's address to the function I get a windows access violation read error. So I assume I have to create and populate the entire TD1 structure in my C++ source file, allocating memory for the arrays, before passing the TD1 address to the function. When I try to do that I get a LabVIEW error "Fatal Internal Error memory.cpp, line 638".
    Any ideas on how to make this work?

    Ok, I fixed my problem. I had to set the TD2Hdl elements in the TD1 structure to NULL before passing the TD1 address to the function. I think this makes sense because if you look at the Butterworth Coefficient.vi that I used to generate the DLL, the inputs to the CIN in that VI's block diagram are empty arrays. So I guess by setting the TD2Hdl elements to NULL, it tells LabVIEW that you are giving it an empty array, which is what the CIN was expecting.
    Hopefully this helps anyone else who has this same sort of problem.

  • Can I use a dll created in Visual Basic 2010?

    I am reading up on the new extention system for air 3.0.
    I have successfully (I think) managed to integrate the Air 3.0 prerelease into Flash CS5.5 (I don't use flex or flash builder)
    So now I am trying to read up and learn how to use extentions.
    Now, I don't know C/C++. My experience with it has been very limited over the years. But I know visual basic pretty well as I have been using that since VB4. (back in the programming stone age, heh)
    Right now, I have Visual Studio 2010 and Flash CS5.5.
    I am developing for the iPhone and iPad and up until now I have created a working iOS application that works pretty well.
    Can I create a dll in visual basic (A class library) and then use the extention system to load that into my application to run on the iOS mobile device?

    I thought I'd seen this question asked somewhere before, but I can't find the thread. In theory there should be no problem. However, you'll need to have both the LabVIEW 5.1 and LabVIEW 8.6 run-time engines installed, and I don't know if there are any operating systems on which both of those versions are supported. If the run-time engine is properly installed, then calling a LabVIEW-built DLL is just like calling any other DLL. There might be some special optimization if the calling application and DLL both use the same version of the run-time engine.

  • Calling a dll created with vision 7.0 from visual basic doesn't work

    I created a dll using some vision 7.0 functions and Labview 7.0 environment. I call this dll from visual basic. The dll will work fine as long as I don't stop the visual basic program execution. As soon as I stop the program execution the dll will no longer work. I must reload the visual basic environment and the call to the dll will start working again. I created the exact same dll but I created it with vision 6.0 in Labview 6i environment. It works great and has no issues.
    Attachments:
    Test.vi ‏36 KB

    Roberto N. wrote:
    Thank you Jordan, I'm using Labview 7.1.
    Anyway I've resolved the problem by adding the "lvanlys.dll" file (present in "..\Labview 7.1\resource\lvanlys.dll" path) as support file in the building process. Now the DLL containing the analysis functions works correctly.
    Natalino Roberto
    Ok, you probably got lucky since the lvanlys.dll seems to implement that function directly. However most Advanced Analysis functions are just redirected by lvanlys.dll to the Intel Math Kerneal Library that gets installed with LabVIEW 7.1 and higher. The only way to get that properly installed with your LabVIEW executable or DLL is to create a LabVIEW installer in your Application Builder and make sure to select under "Installer Settings->Advanced" the "LabVIEW Run-Time Engine" and the "Analyze VIs Support". Then use that installer to install your DLL on another computer.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to call LabVIEW ActiveX dlls into VB6

    I'm jumping in on a project written primarily in VB6. I'd much rather wirte code in LabVIEW so what I am looking for is some example code for calling LabVIEW activeX dlls into VB6. Does anyone have example code? I need to see how the LabVIEW libraries and classes are called and used in VB6.

    Hi Drewdafis,
    Refer to this link for example code on calling a LabVIEW DLL from Visual Basic.
    Hope this helps!
    Best Regards,
    Jonathan N.
    National Instruments

  • Passing Array of Srings between Visual Basic and Labview dll

    I have searched and searched for the correct way to pass an array of
    strings between Visual Basic 6.0 and a Labview 7 dll. So far, I still
    do not know how to pass the array. When I create the dll in LV, the
    array of strings is presented as a string, not an array. I am familiar
    with passing arrays of type double, but I really need to know how to
    pass an array of strings. Any and all help is appreciated.
    Bob

    Hey Bob,
    From what I understand, that can get kind of messy. You have to allocate the memory in VB in the format that LabVIEW expects (see the externalcode.h file in National Instruments\LabVIEW 7.0\cintools for details). Then pass a pointer to that location to LabVIEW. There are a couple of related examples online. They don't necessarily show how to pass an array of strings to VB, but they should show how to pass a string and an array. I hope this helps.
    Using Microsoft Visual Basic to Call LabVIEW DLLs That Pass String Data Types
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B123AE0CB9B0111EE034080020E74861&p_...
    Using Microsoft Visual Basic to Call LabVIEW DLLs That Pass Array Data Pointers
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3D9E556A4E034080020E74861&p_...
    Regards,
    Chris J

  • 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

  • Labview Calling DLL with 2D array input and output

    Hi all,
        I have to call  a dll which a 2D double array as an input and also a 2D double array as an output.The dll is made by me and written in c language , I need it to work  efficiently.
    If i define the program in labview like this
    The 2 2Darrays sent into CLN were "Array data pointer",then how to define the function in c laguage? just like  -----int  myfunction (Parameter1,Parameter2,Parameter3,Parameter4)
    If the function in the dll is defined like this         int myfunction (double  **A, int sx,int sy ,double **B,int ix,int iy),then what will the program in labview will be ?
    sx ,sy ix ,iy are the array's size.

    ylongwu wrote:
    If the function in the dll is defined like this         int myfunction (double  **A, int sx,int sy ,double **B,int ix,int iy),then what will the program in labview will be ?
    sx ,sy ix ,iy are the array's size.
    Your proposed prototype double ** seems to indicate that you want an array of pointers to the rows of the array. That is not how LabVIEW stores multidimensional arrays (nor how this is usually done in C for such arrays).
    LabVIEW and most C libraries threat multi dimensional array as one single block of memory where the rows are located one after the other. So as DFGray has already pointed out you should use double * instead as datatype or since you create the DLL yourself and if it doesn't need to be compatible with other environments than LabVIEW change that altogether into:
    typedef struct {
       int32 dimSize1;
       int32 dimSize2;
       double elm[1];
    } 2DDblArrRec, **2DDblArrHdl;
    int myfunction (2DDblArrHdl A, 2DDblArrHdl B);
    then change the Call Library Node parameters for the arrays to pass the array as Data Handle (the native LabVIEW datatype) and leave away the extra dimensions since they are already inside the handle structure.
    Last but not least if you want to be very fancy you can even use NumericArrayResize() on the output handle to resize it to the correct size before filling in your information and leave away the Initialize Array function on the LabVIEW diagram.
    Message Edited by rolfk on 05-26-2010 09:11 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Pass 2D array from LabVIEW to C# problem

    Hi , I have made a dll using .net assembly to use my labview code in c# . I can easily pass string , numerical and 1D arrays from labview to c# and vice versa, but when I want to read back 2D U16 array from Labview in c# I get the following exception although they have exactly the same type (ushort)
    Cannot widen from source type to target type either because the source type is a not a primitive type or the conversion cannot be accomplished.
    Could you please let me know how should I pass 2d array from labview to c#
    Thanks

    If all else fails, you could pass n 1D arrays across and then put the original 2D array back together. That's probably how the computer would do it behind the scenes, anyway.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Error while using LabVIEW 8.2.1 Dll from Visual C++ 6.0

    I am getting an error while using a LabVIEW 8.2.1 dll from Visual C++ 6.0 application. This is what I am doing:
    1) Created a dll using LabVIEW 8.2.1 (I used a tutorial from NI knowledge base: "Creating DLLs from 6.0i". It is a temperature conversion VI; input DegreeF and get DegreeC out). Instead of LabVIEW 6.0i, I used 8.2.1. It created the dll Convert_Temp.dll successfully.
    2) Then I created a Visual C++ 6.0 application (used a tutorial from NI knowledge base: "Calling a DLL from Microsoft Visual C++ that was Generated by LabVIEW 6i). I could build the project and create an executable application F_To_C.exe.
    3) Then copied the LabVIEW dll Convert_Temp.dll into the folder where F_To_C.exe resides. Using windows explorer, went into that folder, and executed the application.  I got the following error:
    System Error 998 while loading the LabVIEW run-time engine (C:\Program Files\National Instruments\Shared\LabVIEW Run-Time\8.2\lvrt.dll).
    Convert_Temp requires a version 8.2.1 (or compatible) LabVIEW Run-Time Engine. Please contact the vendor of Convert_Temp to correct this problem.
    I checked the folder: C:\Program Files\National Instruments\Shared\LabVIEW Run-Time\8.2\. It has the file lvrt.dll.
    So why am I getting this error?
    GKB

    sounds like you need to install the LabVIEW 8.2.1 runtime. Not the 8.2 runtime engine.
    Paul <--Always Learning!!!
    sense and simplicity.
    Browse my sample VIs?

  • Creating a DLL in Labview 8.6 and calling it from Visual Basic 6.0

    Dear friends,
    I need to create a DLL in Labview 8.6 and call it from Visual Basic 6.0. The system works as follows:
    I made an application using Labview 8.6 + Vision Assistant 8.6 where I can obtain the x,y coordinates of a template in an certain image being captured by an USB camera. The template coordinates change every time it moves and Visual Basic 6.0 must read these x,y values in real time. I found some information in the link http://zone.ni.com/devzone/cda/tut/p/id/3925, but it works for version 6.x of Labview and 8.6 version is different. Am I in the right path? If you have an updated tutorial like the one in the link above but for Labview 8.6 It would be very nice. Please help me.
    Kind regards.
    João Júnior

    Hello Osvaldo,
    I analysed the updated tutorial you sent me, but the thing is that it doen't show how to create the DLL in LV 8.6 but only show how to accessing the DLL from VB6. My problem is really HOW TO CREATE THE DLL IN LV8.6. In the link http://zone.ni.com/devzone/cda/tut/p/id/3063 there is detailed information about how to do this in LV6.x, the problem is that I don't find the path Tools»Build Application or Shared Library (DLL) in LV8.6, I think the procedure in LV8.6 is a little bit different. Don´t you have an updated tutorial on how to build a dll in LV8.6?How could you help me?
    Kind regards.
    João Júnior

  • Pass a value to a dll under labview

    I have to build a dll under cvi and use it under labview. my problem is to pass a value to this dll from labview.
    But when I use it, labview return an error code and close the software...
    I can return value from the dll to labwiew but not the contrary. can you help me please.
    I am a beginner and I am sorry for my english..."
    don't think it's a calling convention beceause When I use the box "call a dll" in labview and I select my dll, I can see all functions I have create in the dll (just the extern functions). for the datatype, I use int or unsigned int and sometimes char. and I can receive this value in labwiew...
    but for the pointer that's certainly my problem
    this is the sourcecode of my function. I drive a digital
    to analogue converter and I want to select the exit (There is 4 exit 0x00,01,10,11 )and a voltage (0 to 255 in décimal):
    void __stdcall dac_sortie_tension (int sortie, int tension)
    outp(LPT1+0x000,4); /* not important*/
    outp(LPT1+0x400,sortie);
    outp(LPT1+0x000,2); /* ecriture de l'adresse2*/
    outp(LPT1+0x400,0x00); /* not important*/
    outp(LPT1+0x000,3); /* not important*/
    outp(LPT1+0x400,tension);/*write voltage*/
    if I use a constant to "sortie" & "tension" it's OK...
    I try to use this:
    void __stdcall dac_sortie_tension (int *sortie, int *tension)
    but it's the same..."
    when I select the fonction in labview, I can see them
    but there isn't argument' ("sortie" & "tension") and I have a void like this:
    void fonction (void)
    what is the problem..
    I can give argument to the function but there aren't used..."

    /*draven*/;
    You need to configure the function manually. Once you select the dll and select the function, select the button Add a Parameter After. You can change the name of the parameter to sortie, keep the Data Type as long and then change the Pass field to Pointer to Value. Click again the Add a Parameter After button and do the same for the your variable "tension".
    For more information about calling external code in LabVIEW, refer to the following document (which should be also included with LabVIEW):
    Using External Code in LabVIEW
    Instructions on-line are here:
    An Overview of Accessing DLLs or Shared Libraries from LabVIEW
    Check also examples here:
    Communicating with External Applications
    Regards;
    Enrique Vargas
    www.visecurity.com
    www.vartortech.com

  • LabView TEDS library into DLL or ActiveX Control so that I can use it in C or Visual Basic?

    We are developing software in LabWindows/CVI and Microsoft C. I heard that LabView can generate DLLs. Can I turn LabView TEDS library into DLL or ActiveX Control so that I can use it in C or Visual Basic development environment?

    Technically what you are proposing is possible with LabVIEW. With LabVIEW's application builder, VIs can be built into dlls. Also, LV has ActiveX hooks and so you could create a system for calling into it from CVI. However, this is not what I would recommend.
    The LabVIEW VIs have been written to a preliminary version of the IEEE specification (1451.4) that describes the TEDS data which is primarily why I'm advising you against using them. Once the IEEE spec is approved (the current timeline is currently late March), it will become public and you can write your own code according to the specification (or wait for someone else to write it). To help you get started, the spec includes flex and bison code that describes the syntax and structure of the template files
    Internally, we've written some C, C++ and Java code to the preliminary version of the spec and we've found that we can duplicate the functionality of the TEDS Library for LV in roughly 2 weeks in any other language.

  • Using a Visual Basic ActiveX DLL in LabVIEW

    I' like to use some code written in Visual Basic into LabVIEW. I think the best way to do this is making a dll_activeX. I've seen an example on NI site: http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CB992111EE034080020E74861&p_node=DZ52048&p_submitted=N&p_rank=&p_answer=&p_source=External.
    When I use the dll present in the "zipped" file it works (I've registered the dll as described in the article).
    If I compile in a DllActiveX the Visual Basic project (Visual Basic 6.0), present in the zipped file, and I try to use, after the unregistrtion of the old one and the registration of new one, it doesen't work.
    I received the following error:
    error 3005Occurred at automation open: Object specified is
    not creatable in a ActiveX Dll with LabVIEW.vi
    Some ideas?
    Thank you.

    Paolo,
    I am not sure why you are getting the error. I downloaded the zip file re-built the dll and then registered it. I originally had LabVIEW open, so I closed and re-opened it so that it would see the new object. I then pointed the ActiveX refnum to the Project1 class. I still had a few broken wires so I hit ctrl-shift-Run Arrow to force a recompile.
    After all that I ran the VI at it worked great. Once that was done I unregistered it and ran the VI. I got an error as expected. I then re-registered the dll and ran it again. No error.

Maybe you are looking for

  • Support for JMS Topic in SAP PI 7.11

    Hi, As per SAP Note 856346, JMS Topics are not supported in SAP PI (Question 2.1). However the Note is valid for SAP PI 7.1 and there is no mention for SAP PI 7.11 So can anybody please confirm if SAP PI7.11 supports JMS Topics? Thanks, Pankaj.

  • How can I download and run adobe 11.5 on mac OSX 10.5.8?

    How do you download and run Adobe version 11.5 on a Mac OSX 10.5.8 operating system?

  • Replication between DC and ADC

    we all know that is there any changes happen in dc it will automatically replicate to ADC.some time quickly or some time very late. i just have a one query how should ADC knows that there have been some changes happens in DC Abp

  • ARP/RARP error

    Hi Solaris Gurus, My server was unable to boot an error message "The message is timeout waiting for ARP/RARP packet." kept on appearing on the screen. Hope to hear from you soon. Thanks in advance. marshal

  • Help about a itunes backup!

    Hi i have a bit of a problem ive been wanting to solve. A while ago i tried doing a update to my iphone 5s through itunes and i think i messed up during it and it froze during the update and made me restore my phone from an old backup so everything t