Creating dll in c++ and using labview to call it

Greetings All,
I have created a .dll file in visual C++ 2005 Express... I have attached both the c file and header file I used to create this dll in the .txt files cfile and header file. I have also included the .dll file itself so that you can use the vi. Please let me know if you have problems using it after you have configured the dll to go to the path you store and call the function ReturnMaxVal.  The problem is the max value keeps giving me a rediculous number. I did this with a 1-D array and it was no problem. If anyone can help it would be much appreciated.
Thanks,
Clint
Attachments:
helpPlease!.zip ‏14 KB

OK, here's a one way to do it. This is the C way, using malloc() to reserve memory.
There's propably a more C++ way to do this, using new and delete, but this works,
although I don't guarantee that it doesn't have memory leaks
This will initialize a 2D int array, but you should get the hang of things with this
example.
#include <iostream>
using namespace std;
int **a = NULL;
void f2(int rows, int cols)
    // create array
    a = (int **)malloc(rows * sizeof(int *));
    for(int i = 0 ; i < rows ; i++)
        a[i] = (int *)malloc(cols * sizeof(int));
    // init values
    for(int i = 0 ; i < rows ; i++)
        for(int j = 0 ; j < cols ; j++)
            a[i][j] = i+j;
            cout << a[i][j];
        cout << endl;
int main(void)
    int rows = 0;
    int cols = 0;
    cout << "Enter number of rows: ";
    cin >> rows;
    //cout << endl;
    cout << "Enter number of colums: ";
    cin >> cols;
    //cout << endl;
    f2(rows, cols);
    // free reserved memory   
    for(int i = 0 ; i < rows ; i++)
        free(a[i]);
    free(a);
    a = NULL;
    return 0;
Hopefully this helps. You can try to google for other possibilities, there seems
to be a lot of forum post about this matter.

Similar Messages

  • HELP !!!I want to give my old apple to my girlfriend, SO SHE CAN PLUG IN HER NEW IPHONE, CREATE AN APPLE ID AND USE MY OLD LAPTOP TO DOWNLOAD itunes music, but im having trouble deautherizing it, and making her the OWNER, IF you get my drift, how to i mak

    Hi
    I have a new powerbook and want to give my girlfriend my old G4 power book, she has a new iphone 5s, and wants to create a new itunes/apple id. When i try to de authorize the G4 and sign in with her new apple ID it says bad password, how can i release the G4 from my cluster of authorized apples and make her the owner so she can download music and more importantly sync her music with her phone, she only has 3 songs on her iphone, and loaded all her CD's into the g4 but cant sync, im no dummy and this shouldnt be hard, but its driving me crazy!!!!!!
    thx u so much for your time heeeellppppp.

    Perhaps, as we have the same music tastes, for now i should just authorize her phone to my power book just to sync music, not pics, contacts etc? I'd hate to overright her contacts etc lol????
    HELP !!!I want to give my old apple to my girlfriend, SO SHE CAN PLUG IN HER NEW IPHONE, CREATE AN APPLE ID AND USE MY OLD LAPTOP TO DOWNLOAD itunes music, but im having trouble deautherizing it, and making her the OWNER, IF you get my drift, how to i mak 

  • How to create a stored procedure and use it in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

  • Calling and using LabVIEW VI's in a C# application : user manual ?

    Hi everyone,
    I am working on a project (actually a proof of concept) where I need to call and use LabVIEW VI's in a C# application.
    I downloaded the example available on this page : Calling LabVIEW VIs from Other Programming Languages.
    This example (joined) is working fine, but I would like to know if there is an associated documentation concerning the .NET classes that I can use in C# when I use the namespace "LabVIEW" (using LabVIEW; in C#).
    I need to know a little more about the properties and methods that are available (what it does and how to use it).
    I looked for it on NI's website and the LabVIEW help but could not manage to find anything interesting.
    Is there an official documentation released ? How can I get those informations ?
    Thanks for your answer(s).
    Regards,
    Da Helmut
    Attachments:
    CallingLabVIEWFromCSharpUsingActiveX.zip ‏114 KB

    Hi,
    The class browser is usefull (ctrl + shift + b), but I am not developing the C# application on the same computer than the LabVIEW application.
    The *.chm file has all the informations in it but I am not finding it well organized. I am drowning in all the informations. I supposed there was a specific help file / manual for the ActiveX methods and properties (a kind of hierarchical view like in the class browser).
    Also I supposed that there were different methods and properties that the one available in LabVIEW.
    For example when I browse the class in C# I get those weird methods :
    Regards,
    Da Helmut

  • How to configure and use labview using java

    I want to configure and use labview in my application using java, please help me out with a solution how i can configure it (like providing input to labview and getting output from labview in java ).
    Thanks,
    ATF

    Did you try a search?
    Or: How Do I Integrate Java with National Instruments Software Products?

  • I am using DNET PCI card from other vendor and using Labview 2013

    i am using DNET PCI card from other vendor and using Labview 2013.
    is it possible to communicate with this DNET card?
    if so how do i find communication visa DNET ?
    please inform me how to find DNET examples.
    thanks,
    san

    Hi santh,
    I don't think it's possible to use a 3rd party DNET PCI with LV API.

  • TS1398 I can no longer sign in to my home fi (bt hub) with my iphone 4. Yet I can get on wireless with my laptop so the hub is working. The only thing Ive done different recently is download and use an app called Onavo mobile ltd which Ive now deleted, he

    I can no longer sign in to my home fi (bt hub) with my iphone 4. Yet I can get on wireless with my laptop so the hub is working. The only thing Ive done different recently is download and use an app called Onavo mobile ltd which Ive now deleted, help pls?

    Read another post in the forum about this and it appears this app also installs a profile with a proxy service that you will have to try and delete as well. Check that out.

  • Create dll with arrays and call it

    I am trying to create dll with labview in order to pass a 2d array to the main program. The problem is that I don't really know how to create the function to call it (I don't know much about pointers)
    The function I have created to call the dll is void Untitled1(TD1Hdl *Array1) which is suposse to return the array created on it.
    For example, in the program attached, how should I do to pass the array to another program using dlls?
    Thanks a lot,
    Juanlu
    Attachments:
    Untitled 1.vi ‏7 KB

    The code you've provided doesn't do anything (just a control wired to an indicator) so I'm not sure what you're asking here.
    If I understand correctly, you want to build a DLL from your LabVIEW VI.  From what language will you call that DLL?  There is no standard way to pass a 2-D array.  If you can convert to a 1-D array, you can use a simple pointer.  With a 2-D array, you're stuck with LabVIEW's array representation (the TD1Hdl type), which means that whatever code calls that function will need to understand the LabVIEW data type and how to manipulate it.

  • How to create a dataplugin for DataFinder using LabVIEW

    We want to use LabVIEW to create a dataplugin that will be used by DataFinder (My DataFinder). We have found on the NI web site the LabVIEW DataPlugin SDK - , a SDK that allow us to create a dataplugin. The SDK is for LabVIEW 8.6.
    The dataplugin example code of the SDK work very well in the “For testing” section of the development project. We are also able to register it to use it through DataFinder. The dataplugin is available in the “Configure ...” window of DataFinder.The problem is that the dataplugin doesn’t work with DataFinder. We didn’t receive any kind of error message or code. We only get the value “eIndexedFailure” in the “Index status” property. After expectation, it seems those input parameters are different between a LV and a VBS dataplugin. And we think that can be the source of the problem. There is someone that can help us about that?
    We also want to use LabVIEW 2009. The SDK example work under 2009, but we get the same problem with DataFinder.
    Thanks
    Solved!
    Go to Solution.

    Dear Kelly R, you're right I can’t open the file in DIAdem. The RegisterLabVIEWDataPlugin.ini file is correct. But I’ve just tried to rebuild the project and then use the Installer instead of just using the Deploy. Now it works, even with my own code. Now I can open the file in DIAdem without problem. The installer uses the “NI LabVIEW Dataplugin 1.0” package. It seems that the SDK installer has never install this package.I thank you all for your help. 

  • How can you create a test plan generator using labview

    I am looking to create a testplan generator using labview to help RF Engineers translate test requirements into test parameters and wanted to know how i can go about it.

    Have you considered to use Teststand? Teststand organizes all the tests and allows to parameterize them.
    Creating a tool with a similar functionality will be more expensive than buying Teststand and modifing the operator interface.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Creating *.dll  in Visual Studio (using c++) for JNI

    Hi,
    I'd like to ask, if anybody has experience how to make *.dll using Visual studio (2003) and use c++.
    I make *.dll library in C ( in DEV-C++), it is no problem in C , but when I use C++, it doesnt work (it is the same in Visual studio)
    I have the same code like in C ( the same header , and the "same" code - in dev-c++ it works well ) but when I try to create this same project using C++ it doesn work.
    Visual studio throws exeption:
    c:\Documents and Settings\patak\Dokumenty\Visual Studio Projects\jniknihovna\jniknihovna.cpp(13): error C2227: left of '->GetStringUTFChars' must point to class/struct/union
    type is 'JNIEnv'
    did you intend to use '.' instead?
    c:\Documents and Settings\patak\Dokumenty\Visual Studio Projects\jniknihovna\jniknihovna.cpp(13): error C2819: type 'JNIEnv_' does not have an overloaded member 'operator ->'
    Well does anybody have any idea how to solve this problem?

    Well I think I use my compiler (dev-c++) corectly:
    My codes :
    *.h file (that is produced by javah)
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class IntArray */
    #ifndef IncludedIntArray
    #define IncludedIntArray
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: IntArray
    * Method: sumArray
    * Signature: ([I)I
    JNIEXPORT jint JNICALL Java_pole_IntArray_sumArray
    (JNIEnv *, jobject, jintArray);
    #ifdef __cplusplus
    #endif
    #endif
    And *.cpp
    #include <jni.h>
    #include <stdio.h>
    #include "dll.h"
    JNIEXPORT jint JNICALL
    Java_pole_IntArray_sumArray(JNIEnv *env, jobject obj, jintArray arr)
    jint buf[10];
    jint i, sum = 0;
    (*env)->GetIntArrayRegion(env, arr, 0, 10, buf);
    for (i = 0; i < 10; i++) {
    sum += buf;
    return sum;
    and in Java : private native int sumArray(int[] arr);
    and again error : 10 C:\Dev-Cpp\dllmain.cpp base operand of `->' has non-pointer type `JNIEnv_'
    (when I compile it as C library, it works , but I need to use C++ in other code, I can find only examples where only *.C is used )
    Maybe here is an error, but I don't know how to solve this problem
    Edited by: patakm1 on Apr 4, 2008 2:28 PM

  • Want to pass pointer as an argument to function in DLL....using labview

    i am using AD 9430 evaluation board and using DLL to talk with the device....
    ..now one of the functions in the DLL is
    long CaptureFIFO(long *data, long numSamples, short FIFOChannel);  
    i cant understand how to give these inputs in labview ...since i dont know hot to use pointers in labview
    Message Edited by shambu on 11-20-2006 06:01 PM

    There are a LOT of examples in the "...\Labview 8.x\examples\dll\data passing" folder of how to pass all kinds of data types to a DLL.
    “A child of five could understand this. Send someone to fetch a child of five.”
    ― Groucho Marx

  • Creating TestStand GOTO step programatically using LabView. Problems.

    Hi
    I am trying to programatically create and configure a TestStand GOTO step, using LabView.  I can create the step fine, but I cannot work out how to specify the GOTO Destination.
    Has anybodt got any ideas?
    Regards
    Steve
    There are 10 types of people in the world that understand binary, those that do and those that don't.

    Managed to solve this one myself by setting the CustomActionExpr to 'True' and the CustomTrueActionTargetByExpr to the name of the step I wanted to jump to.
    Steve
    Message Edited by SercoSteve on 01-24-2006 02:13 AM
    There are 10 types of people in the world that understand binary, those that do and those that don't.

  • Can I create a XSL function and use it in the Word Template

    I have a complicated logic (complicated if i have to repeat it 400 to 500 times) for determining if I should show a null expression. If the value is null or equal to 0 show N/A else show the value.
    If I have to repeat this over and over again and it turns out to need an update this would be a nightmare. But I don't have time to waste on a wild goose chase either. If I have to do something a couple thousand times i better get started basically.
    Can I create a function in the word template then call it throughout the word template for each field I have to check?
    Have a link to a tutorial that is doing this?

    If you really want to have a function, you have choice of using subtemplates (either RTF or XSL)
    You can check for steps here
    http://www.oracle.com/technetwork/middleware/bi-publisher/overview/bip-subtemplate-1-132933.pdf
    But if you have functions or use the code directly you anyway need to modify your 400-500 fields.
    i.e. either
    <?xdoxslt:ifelse(COLUMN='','NA',COLUMN)?>
    or <?call:template_name?>

  • Create a css file and use it

    Hi
    i use jdev 11.1.1.7
    I have several items on the page . for example panelFormLayout .
    i want declare several property (background-color ,...) and assing it to all of panelFormLayout .
    so whenever i change color of background ,  background color of ALL panelFormLayout change easily .
    (I created a css file and declared my property in it but i cant use it !!! )
    NOW i hope to create a CSS file or(any thing you suggest) for this reason and use it .
    How can i do this ?
    Thanks alot

    You can also download the stand-alone Skin Editor to help you create the skins and style you want.
    A bit more on the topic here:
    https://blogs.oracle.com/shay/entry/styling_specific_adf_components_with

Maybe you are looking for