LabVIEW dll call struct complex

Hello

I'm just creating a LabVIEW library for a Dll driver. The Dll contains complex structures. I just want to know if I can get around creating a wrapper Dll for these calls.

It is an example of a function call:

Error AA_querySlaveInfo (handle hSlave, SlaveInfo * pSlaveInfo,)

int flags);

typedef struct {}
vendorId int;
int productId;
review of int;
int series;
const char * group;
const char * image;
const char * order;
const char * name;
int objCount;
DataObjInfo * objs [1];
} SlaveInfo;

typedef struct {}
the type of object int;
const char * name;
int bitLength;
} DataObjInfo;

Aid is quite aprechiated.

Thank you

Hi Keppi,

This is not possible, sorry. Without the last entry in the struct that it would work, but this pointer to the another struct... you'll need a wrapper for it!

I hope this helps,

RMathews

Tags: NI Software

Similar Questions

  • LabVIEW DLL called from C

    I would like to create a DLL in LabVIEW which can be called from a C program.

    The purpose of the DLL is to display a dialog box along side a C program user interface and view a picture is updated continuously in the program.

    The LabVIEW DLL would be

    1 would be considered to be a dialog box that opens up along the side of the user interface of the C program.

    2. the DLL would regularly be called with the parameters passed by the C program.

    3. the dialog box would contains a picture that is updated by the parameters of the permanence of program C.

    Is this feasible?  I assume that the DLL has to work like a demon, because the DLL is a dialog that must cover along the side of the user interface of C.  To run a DLL written in LabVIEW, is the needs of PC - the runtime?

    Everything was OK until 5. For 6, you do not get a reference to something C. You simply call the exported function that is the VI 'set params.

    I have included a sample project to give you an idea. The code LabVIEW is written in LV 8.2 and the project with a version of a DLL specification. I used c# for this example, but you can easily translate it c If you wish.

  • Problem calling LabVIEW DLL with c#

    Dear all,

    I compiled a few DLLs in LabVIEW and called these DLLs using c#.
    I'm having trouble passing in strings and arrays as input and output of the DLL.

    Whenever I try to view the string I have entered in a dialog box (this part is written in LabVIEW DLL), a LabVIEW message dialog box appears and the program just stuck there.

    Whenever I try to enter a string or an array to the dll, Microsoft Visual Studio would display "attempt read or write protected memory. It is often an indication that other memory has been corrupted. »

    I attached the vi and also the c# .sln file.

    Can you guys please advise where am I wrong?

    Thank you very much.

    You must allocate strings and arrays of output!

    private void button1_Click (object sender, EventArgs e)
    {
    output string;
    int [] value;
    StringOutput ("A", "B", exit, 3, value, 4);
    }
    }

    Your variable output and value must be preallocated to ensure storage of 3 items respectively. 4. and since you want to receive the C string that you need to increase this to 4 characters terminated by a NULL value.

    String in c# is also a not a C string of object pointer. You must declare the StringOutput() function as follows:

    [DllImport("SharedLib.dll",CallingConvention=CallingConvention.StdCall, Charset=CharSet.Ansi]internal static extern int StringOutput(StringBuilder A, StringBuilder B, out StringBuilder StringOutput, int sizeString, out int[] output, int sizeArray);
    

    Then call like this:

    StringBuilder output = new StringBuilder(4);int[4] array = new int[4];
    
    StringOutput("A", "B", output, output.Capacity, value, value.Length);
    

    Please note that I'm not a pro in c# and usually do not do much in it. Also that this code has not been tested or updated at all, so probably contains some errors. He however point you in the direction of where to look further.

    What you need to understand, is that the C DLL that you created in LabVIEW has a so-called unmanaged interface. This means c# is not able to know how to manage the memory for the parameters at all and you have to do everything yourself, where the obligation to explicitedly initialize variables output and table with a block of memory préallouée.

  • The DLL call fails when DLL uses a wide range

    I call a C++ dll in LabVIEW 32-bit on Windows 7. I kept getting error 1097 and finally understood it is because the dll uses two large paintings of 5 MB each. The tables are initialized in the constructor of an object, malloc is not used, or whatever it is. If I do the smaller berries, then everything works fine.

    The problem is not difficult to work around, now that I know what is the cause, but can someone tell me why a dll using a lot of memory would be a problem? I feel that 10 MB is really a lot of memory to use on modern computers.

    OK, you can test the appeal of the DLL in a Visual Studio test harness?

    In addition, in case you haven't seen another 'DLL error 1097' son type, here are a few. The cause of 1097 in your case can be illuminated by a multitude of courses of troubleshooting:

    Call dll error 1097

    Error code coming 1097 in DLL call

    error 1097 after the call dll function that allocates memory inside

    1097 error in the transition from table from C++ DLL for LabView (seems very relevant, although long)

    I know there are a lot of reading, but there is a good chance that the magic trick is in one of these threads already. We will ride on the shoulders of their work.

  • Loop timed in LabVIEW DLL does not close

    Hello!  I have what I think, it is a simple loop timed in LabVIEW that stops after 100 iterations by throwing an error and letting the loop 'stop on error.  It works fine when it is executed in the ordinary LabVIEW environment, however, when compiled as a Dynamic Linked Library (DLL) and called from LabWindows it requires me to put an end to execution, rather than going out nicely.  As well, it seems to leave the real appeal of virtual Instrument very well and go to the next line of code, but when my function main() in LabWindows is completed it must always be something not cleaned which is the cause not come out well.  Any ideas?   I tried to add only a call to QuitLabVIEW and that doesn't seem to do it.

    Thanks in advance - hoping you will notice an error really easy. )

    A photo of the timed loop is attached.

    An excerpt from the code of LabWindows:

    int main)
    {
    CallMyLabVIEWDLL();  This line launches successfully and closed the window for my virtual instrument LabVIEW
    MessagePopup ("' My Title:", "That occurs after the call to your LabVIEW DLL" ");    This popup appears - indicating the call to the DLL has finished

    But after the code has completed LabWindows always shows "running", rather than close.

    return 0;
    }

    Why do you use a loop timed in the windows environment?  They are best used for real-time environments (not windows) and tend to have more support than the time.

    Is there a particular reason, a while loop will not work?

  • Under .dll call of Mobile 6 PDA

    Hello

    I wish I could call a .dll in a SW developed on LabVIEW PDA and I have a problem with regard to the opening of This that me is provided by United Nations levels.

    FYI, I know that it is possible to make such an action (what we already inside of this application) but I want to know it is the necessary details about building the DLL.

    Indeed, should activate parameters specific to the level of the compiler (or other)?

    Pour info: the dll that does not work is generated Microsoft Visual C++ 4.0 integrated on an ARMv4 target (the PDA is ARMv5 TE normally backwards compatible)

    PS: question subsidiary-online is it possible under LabVIEW PDA call an EXE? (IE like what you can do in windows via the call to the command line).

    Thank you.

    Hello

    Calling external code (.exe or .dll) since a VI LabVIEW PDA is not as simple as for a classic VI.

    The two following privileges (and privileges which are mentioned) should be helpful to you:

    Launch an external program of LabVIEW Mobile or Application of Module Touch Panel
    http://digital.NI.com/public.nsf/allkb/8F811FFA7BACEC2486256FC5006DB821?OpenDocument

    Calling external Code in LabVIEW PDA and touch screen
    http://digital.NI.com/public.nsf/allkb/517300B49212795986256DDD00623FEE

    Kind regards

  • Set the string for LabView dll parameter

    Hello

    I created a simple vi LV 2010 (departure vi), which reads the identification of an oscilloscope. Then I take this vi and incorporate it into a dll of LabView. I have test the dll calling LabView (RunFrom dll). Basically, it seems to work, but len and ReadBuffer back empty. It must be in the way I'm configuration configuring the setting for Readbuffer (settings) in the configuration of the dll. I tried several different configurations, but nothing seems to work. Any help is appreciated!

    What is the parameter len?  Normally, you should only set the length of the string, but it seems that you did not do this.  Also, you're passing len by value, and not by reference, so the function is expecting her to be a starter and you will never get return a different value to any value that you provide.

    Do not use a local variable of the ReadBuffer for entry "readbuffer".  You must pass a string initialized long enough to contain the expected quantity of data.  The best way to proceed is to use the array to initialize to create a table of U8, then use the array of bytes to a string.  Set the parameter 'minimum size' to 'len' then run through the length of the string initialized (this is not mandatory but is recommended).  If you need the length obtained output, add another indicator and another parameter to this value.  There might be a way to do it with one by len parameter passing by reference, you need to experiment (it is certainly feasible in C but I don't know if allows him to LabVIEW).

  • I'm doing a Shell call Firefox in the directory C:\Program Files (x 86) of \Mozilla FireFox\ and LabView shell call gives an error.

    I'm doing a Shell call Firefox in the directory C:\Program Files (x 86) of \Mozilla FireFox\ and LabView shell call gives an error. I can go to the BACK shell and make the fine call, but Labview Shell gives several errors. Anyone know how to get around the problem of directory with the name of the Program Files (x 86) directory with space and the (x 86) BACK doesn't seem to like?

    You must use quotation marks.

  • Generation of C++ with LabVIEW DLL error

    Hi, I am a student at the UC Irvine, learn how to use LabVIEW.  I'm working on a practice project for which I use a PID system to control the temperature of an object.  Things are starting to be a little awkward with the control statements nested, loops, etc., so I thought I have exported a LabVIEW DLL with all the difficult to encode things like interfacing with my instruments and tracing of data or something else and do the calculation and follow-up of the commands in C++.

    The DLL file I made in LabVIEW exploded without a hitch, as far as I can tell, but when it a link to my C++ test program (which at this point is just including the .h file of the LabVIEW for the DLL and an empty main() function), I get a lot of build errors.  I'm using Dev - C++ that uses g ++ to compile the code.

    Here is a picture of my build errors:

    Normal windows applications are not so forgiving on where you can put your DLL under LabVIEW. You must have a DLL or in the Active Directory where the executable file itself (this is your build directory, not the source directory), windows or directory system or any what directory defined in the PATH environment variable. Anythin else probably won't work, or at least not reliably.

    No need to add the cintools directory to your include paths or paths of the library file. You must only that if you decided to leave native LabVIEW DLL export data types, in which case you would need Manager of LabVIEW to prepare the correct data buffers.

    Rolf Kalbermatter

  • Get the 1097 error when trying to call a Labview DLL

    I had to write a wrapper DLL to use some functions in the DLL to a third party, and I'm having a few problems. I created an executable to test my code and it works fine, but when I try to execute the same function in the DLL that I created in Labview, I get error 1097. I read through most of the posts on this forum about this issue, but none of the proposed solutions are working for me. I'm sure this isn't a question of transfer settings to COLD LAKE because I changed the function so it only accepts a single entry (a number he obtains from a Subvi, which came from the third-party DLL, this entry is working with a bunch of other functions, so I don't think that is the question).

    I have attached the C code that creates the wrapper, but I don't know how it is useful without familiarity with the functions of the original DLL. I hope that someone can spot something basic I am out of my code, but please let me know if I need to call something else.

    I use a Labview 32 bit version 2012 on a 64-bit Windows 7 computer.

    Thanks in advance for any help!

    You should read the documentation on LoadLibrary() and understand. Essentially if you provide a full path to LoadLibrary() the DLL MUST be present at this place so that LoadLibrary() will succeed. If you pass only the name Windows DLL will ONLY search in these places:

    (1) if the module (the DLL) is already loaded it will return a handle to the loaded module and increment its reference count

    (2) if the referencing module contains a manifest (either incorporated into the image module or in a separate manifest file in the same directory as the executablemodule) specyfying a version number for this DLL will load this DLL with this version of the SxS (side by side) location and failure if it is not present

    (3) if the executable load contains a manifest (either incorporated in the executable file or in a separate manifest file in the same directory as the executable file) number specyfying a version for this DLL, it will load this DLL with this version of the location of SxS (side by side) and fail if it is not present

    (4) it will search for the DLL in the same directory as the directory where the current image of the process is loaded. It is NOT the directory of the DLL loading the DLL, BUT the directory where the EXE file from which the process was created.

    (5) in the system directory

    (6) in the Windows directory

    (7) any directory in the PATH environment variable

    (8) the path of current directory which is a location managed by windows by process and changed the two explicitedly when the application calls the API SetCurrentDirectory() but also implicitedly by things like the file selection dialog whenever it is rejected by other means than the undo operation.

    Essentially putting your dependend DLL in the same directory as the wrapper DLL does NOT work when you use the name of the DLL only UNLESS you place the two DLLs in the same directory as your executable file. If you don't want this restriction and want to be able to move these modules together in different directories, you don't have to create the correct path in your wrapper to LoadLibrary(). Basically, you must have the code to determine the location of your DLL wrapper path and then strip her own name and add the DLL name wrapped in it and then move to the LoadLibrary().

    There are several ways to determine the path of the current module. The simplest if you don't mind having the name hard-coded in your code DLL would be to ask GetModuleFileName (GetModuleHandle ("yourDLLname"), buffer, size).

  • TestStand do not call a Labview DLL copied to a new location.

    TestStand v4.2 & v8.6.1 LabVIEW: I have a problem with TestStand calling a Labview project DLL. It will call the DLL successfully if it points its record source (the directory where the DLL was built. However if the DLL is copied to the clients working directory and the appellant TestStand step points to the copied DLL, the problem occurs. The TestStand calls the DLL from the working directory of the client, but does not execute the DLL, simply set the status of the step to "Done" where he clearly didn't.

    The vi named in the DLL has correctly, all handles error clusters such that if there is an error in the vi running, the error would be forwarded to TestStand.

    Any ideas please?

    Update: the original problem was never solved, but another method was used successfully to generate an Excel results worksheet. This used controls Active-X to open a file, import a model, write the data, close the file, and then make the new file read-only. It now everything works fine.

  • Create DLLS in labview and call it from another application

    I have an application built using Labview. I wanted to create a DLL out of it. At the request

    two string entries start and stop buttons and two indicators of the State.

    1 how to itegrate start and stop buttons to a function prototype?

    2. what Labview created dll requires the labview runtime engine if it must be called from other applications?

    Can help with that.

    Hi Yuvish,

    (1) they must be entered Boolean to your VI. But, it is a good idea to make a stop at the beginning of your VI contribution? (THINK THE STREAM!)

    (2) Yes, LV - RTE is required...

  • Need help with implementing DLL based on LabVIEW below call Lib

    Here is the list of C functions in the doc that I have, but I don't get the right result.

    I need help to understand how these features and how to configure it in LabVIEW

    Parameters

    voltType
    [in] Specifies a voltage detector to get the value of. There may be flags
    VCORE (1<>
    V25 (1<>
    V33 (1<>
    V50 (1<>
    V120 (1<>
    VSB (1<>
    VBAT (1<>
    VN50 (1<>
    VN120 (1<>
    ATV (1<>
    retval
    [out] Points to a variable in which this function returns the voltage in volts.
    Typesupport
    [out]
    If the value is specified as a (non-NULL) pointer to a variable, it will return the types of sensors available in indicators at the level of the ILO-ORed
    Return value
    TRUE (1) indicates a success; FALSE (0) indicates a failure.
    Remarks
    Call the function first with a typesupport non-NULL of the sensors available fan and a subsequent call to get the required voltage.

    Thanks to all...!

    I solved this problem.

    There was a problem in the configuration of the VoltType. We have a cluster of bits.

    Here is the screenshot.

  • (UN) Managed Wrapper calling LabView-Dll

    Hello

    I'm focused with a strange behavior that I couldn't explain.

    I had to extend the NI272x in my environment unmanaged c++ to a StepType http://sine.ni.com/cs/app/doc/p/id/cs-11443/lang/de/pdf/yes/pdf that descripes a functional testsystem.

    Provieds let us OR no C Api for this devices. But the LabView drivers were available. So I did LabView Wrapper
    to consume. It worked well.

    Current development of extension is done in c#. During execution, it loads the unmanaged Dll StepType old. If the Dll of LabView is
    used. I'm not able to load the DLL with c# via LoadLibrary SDK to memory.

    To understand what is happening I have provied a small project that descripes the task.

    Concerning

    Jürgen

    I think that the problem is that the dll you load dependent DLLS. The normal behavior of the LoadLibrary does NOT automatically search the dependent DLLs in the same directory as the dll you are loading. You must instead use LoadLibraryEx with the LOAD_WITH_ALTERED_SEARCH_PATH option (it's what teststand uses when loading DLLs with adapter c ++). See info on help from Microsoft on MSDN for details on LoadLibraryEx and LOAD_WITH_ALTERED_SEARCH_PATH.

    Hope this helps,

    -Doug

  • Error code coming 1097 in DLL call

    Hello

    I get the error code 1097 in the DLL function call. Please find the DLL by calling the function for more information.

    Function: GetControllerListTest (Controller * ptrControllertest, char * max_controller);

     

    Parameter Controllertest details:

    set NO_OF_CONTROLLER 100
    #ifndef CONTROLLER_STRUCT
    typedef struct
    {
    CString name;
    status of tank;
    CString blocked_by;
    Char group;
    } controller;

     

    Data type for the parameter Controllertest is structure. In LabVIEW, I configured the parameter as a cluster.

    name: line control

    status: complete control U8

    blocked_by: control string

    Group: entire control U8

    Could you please confirm it, did I set up the type of data in a correct way?

    I'm getting output empty table and the error Code of the DLL 1097. Can you please tell me where I am missing?

    Thank you

    Sivaramkumar.V

    What type "CString" defined?

    If it's a C++ type, as defined here, then you can not call this function directly from LabVIEW because LabVIEW can not pass of C++ types.  In this case, you will need to write a wrapper (in Visual Studio or another C++ programming environment) which takes a string (character array) standard C as an input, creates a CString from her and calls GetControllerListTest.

    If CString is defined as a fixed-length character array, then you need to replace the strings of LabVIEW with clusters of U8 containing a number of elements equal to the string length (LabVIEW does not support arrays of fixed length).

    If CString is defined as a pointer to a character array, you can pass the data to LabVIEW, but you must call the memory manager of LabVIEW functions to allocate memory for the string data and copy it.

Maybe you are looking for