receive a cluster from a dll function

Hello

I have a function in a DLL, which returns a C structure.  I want to know how can I get a cluster of a COLD LAKE?

Info struct:

struct {} typedata

int a;

int b;

const char * c;

int d;

int e;

} data;

function call:

const typedata * hostinfo (int param);

There are a lot of posts on this forum about this problem. Answered by me or Nathan. Try to search and find them.

Basically, it is possible, but requires you to play a little compiler C can be a mesmerizing experience, if you don't know C AND how to work a C compiler.

You will need to configure the value of return as an integer pointer size and then copy its contents into a compatible structure of LabVIEW by using a call to MoveBlock (a very good search for this problem term) or the GetValueByPointer node which Nathan often recommend (and are another good search term for that).

Tags: NI Software

Similar Questions

  • How to call a dll from another dll functions

    Hi, can someone please tell me some examples or instructions on how you go about calling functions from a dll from another dll including the IUR. The two DLLs were created with labwindows cvi.

    Thank you!

    Hi Sinnas,

    You mention that you use a UIR.  A DLL does not have a file UIR as part of it.

    DLL1

    Instead, when you build the DLL first, we'll call it DLL1, you create a header or the files that contain functions that you want to the client code to call.  When you build DLL1, you must export the file DLL1 function for his client to call code header.  Whatever the calling code is (a GUI or another DLL), you must include in the exported DLL1 project headers AND DLL1 .lib file generated when you generate it.

    DLL2

    DLL2 will contain in its project, the header file exported for DLL1, DLL1 .lib file - that gives it the feature in DLL1.  The code can then call any desired DLL1, but as DLL1, you should now have a header file that exports the functions of DLL2 desired HIS client code to call.  When you build DLL2, you create a .lib for THAT DLL file to include in the code of the final customer.

    GUI

    The final customer code will be a few GUI that you create to call DLL2 functions will have the UIR upper layer file.  It will include the exported DLL2 header file and the file .lib DLL2 in his project.  It can then call any function of DLL2.  It is the most clean way to have 2 dll working together.

    NOTE: You can create a GUI to test the lower level DLL1 functions before placing DLL2 in the system.  In fact, it's a good idea to do it - you want to make sure your lower level DLL1 code works properly before construction above it.

    Simple diagram

    Client code (calls to functions of the DLL2 header files) exported

    --------------------------------------------------------------------------

    DLL2 (DLL1 function calls exported in header files)

    --------------------------------------------------------------------------

    DLL1<--------------------  you="" can="" also="" create="" a="" gui="" that="" only="" calls="" dll1="" exported="" header="" files="" to="" test="" out="">

    A suggestion... I create my dll in debug mode and use them to test my code.  But I also build as static libraries.  When I do the final version of the system, I use static libraries.  They are built with the final executable and don't require additional files to install as do the dll.  When you install your system with DLLs, you must include all THE dll and they must be installed in the folder Windows/System32 of the target computer.

    I hope this helps...

    Judy

  • How to transfer data from a DLL Delphi pascal class to a LabView data cluster?

    Hi all

    I have the following problem:

    I use a dll written in Delphi Pascal to transfer data to LabView by using the "Call library function node".

    My Delphi dll contains this class:

    TFlash = class
    Fi: TFileInfo;
    constructor Create;
    procedure LoadFi (Filedir_and_nametring);
    end;

    TFileInfo = record
    IDX:smallint;
    IdxLstSpl:array [0.4] of longint;
    Ms: Word;
    [0.4] SP:array of the word;
    end;

    I created the record datastructure of TFileInfo in a cluster of LabView to have the 'same' variable.

    My plan was to call a DLL Deplhi function with the "call library function node" and pass the address of the folder TFileInfo, so the data would be transmitted to the cluster of LabView.

    When I do a simple delphi dll function as this works because I only spend a small integer to Labview (without reference to the data structure):

    ...

    var data: TFlash;

    ...

    function GetNrOfRows(FilePath:_string):integer; STDCALL;
    Start
    Data: = tflash. Create;
    Data.LoadFi (FilePath); This function returns the number of lines in the selected file.
    Result: = Data.Fi.Idx;
    end;

    When I try to use this procedure instead of the above function, in order to pass the address of the data set structure complex 'Data' (TFileInfo), I am unable to get the information of 'Data' in my Labview cluster:

    procedure LoadFileInfo (FilePath: string;) DataPointer: Pointer); STDCALL;
    Start
    Data: = tflash. Create;
    Data.LoadFi (FilePath);
    DataPointer:=@Data;
    end;

    Parameters of call library function node:

    -stdcall (WINAPI)

    -Run in the UI Thread

    -Function prototype: void LoadFileInfo (PStr FilePath, void * DataPointer);

    * DataPointer--> Type: "adapt the type" and the format of the data: "pointers to the sleeves.

    * FilePath--> Type: 'string', format of the string: "pascal string pointer.

    I'm struggeling with this problem for almost a week now and I can't really find a solution on the forum or google.

    I also read the following posts:

    http://forums.NI.com/NI/board/message?board.ID=170&message.ID=229930&requireLogin=false

    http://forums.NI.com/NI/board/message?board.ID=170&message.ID=77947&requireLogin=false

    http://forums.NI.com/NI/board/message?board.ID=170&message.ID=51245&requireLogin=false

    (or did I miss something in these messages?)

    Hope my explanation is clear.

    THX

    A little further:

    Seems like it's not possible to pass data from Delphi to Labview through a DLL when I create a cluster with 2 bays in it in Labview.

    This part of Delphi, I've had to make in Labview:

    TFileInfo = record
    IDX:smallint; {integer; Convert tool}
    IdxLstSpl:array [0.4] of longint;
    Ms: Word;
    [0.4] SP:array of the word;
    end;

    Instead of using 1 cluster with all the different data in it, I did a unit (1) with my 2 items (smallint and word).

    To pass my data in my tables from delphi to labview, I created another group (2) in the unit (1) with 5 elements of longint (because my delphi is going to 0.4) and another group (3) in the unit (1) with 5 Word elements.

    Right-click on the unit (1) and the clusterorder in the right order. First the smallint, then the longint table, then the word and the Word table.

    When I then use this code in my dll Delphi, IT WORKS! :

    procedure LoadFileInfo (FilePath: string;) DataPointer: PtrTFileInfo); STDCALL;
    Start
    Data: = tflash. Create;
    Data.LoadFi (Copy (FilePath, 2, length (FilePath)-1));         --> I need to cut the first part of the pascal string because it's length, and I only need the string itself
    DataPointer ^: = Data .fi;       --> pass the record structure to the cluster of Labview
    end;

    Thanks for the info Ralf!

  • Pass the parameter to the functions called from a dll

    Hi all

    I am interfacing a motor controller for PMC - 100 through the Protocol of Performax using labwindows.

    I need to explicitly link the PerformaxCom.dll and call functions with him. I'm calling this function

    BOOL fnPerformaxComOpen (DWORD IN dwDeviceNum, OUT HANDLE * pHandle);

    Faithful:

    If you want to link explicitly, you can consult this article: http://zone.ni.com/devzone/cda/tut/p/id/8503

    It has a code snippet that shows passing two parameters to a DLL function.

    But as for your statement that "I don't know how to pass parameter to him", in the example, you reference, you pass a parameter: it's just a constant string rather than a variable.

  • How to pass a string to a vi from a dll?

    I have a DLL that generates errors in the log. How can I display my Panel before these errors? In other words, how to pass a string from a DLL to a vi using the library to call feature?

    Thank you

    Diego

    The DLL actually allocates memory for the string? If this is the case, there should be another function to free the memory. Otherwise you won't be able to do the deallocation of LabVIEW, which means you would have to write a wrapper DLL. If you do not have the deallocation, then you will have a memory leak.

    Are you sure that the DLL is not simply wait for a buffer "of a proper size? In this case, you can simply create a U8 in LabVIEW to a size that is larger that the largest string that you expect to get.

  • Two parallel executions, calling a DLL function

    Hello

    Since this test takes about 6 hours to test my USE, I plan to use the parallel model to test 2 UUT at the same time in parallel.

    I implement the test code as a DLL of CVI.

    However, to my surprise, it seems that the steps that call a DLL function actually traveled in one series, not in parallel:

    Test 2 power outlets if one enters and executes a DLL works, the other waits for the first to complete its operation and return. While the other runs on the same copy of the DLL, so that the DLL global variables are actually shared between executions.

    So if a DLL will take 5 minutes to complete, two executions in the running at the same time take 10 minutes. This isn't a running in parallel in every way.

    What I want and expect also TestStand, was to completely isolate the copies of these two executions DLL such as test two casings could run at the same time the same DLL function by arbitrary executiong their copy of the function, completely isolated from one another.

    So they separated globals, discussions, etc., and two parallel jacks take 5 minutes to run a step, instead of 10.

    Such a scenario is possible?

    If not, how can I use my test in parallel (in truly parallel) when the use of 2-socket test?

    (1) Yes, he'll call the multiple executions in TestStand calling into the same dll in memory the same copy of this DLL. Thus dll called in this way must be thread-safe (that is written in a way that is safe for multiple threads running the code at the same time). This means usually avoiding the use of global variables among other things. Instead, you can store the thread shows in local variables within your sequence and pass it in the dll as a parameter as needed. Keep in mind all the DLLs your dll calls must also be thread-safe or you need to synchronize calls in other DLLs with locks or other synchronization primitives.

    1 (b) even if your dll are not thread-safe, you might still be able to get some benefits from parallel execution using the type of automatic planning step and split your sequence in independent sections, which can be performed in an order any. What it will do is allow you to run Test a socket A and B Test to another socket in parallel, and then once they are then perhaps test B will take place on one and test one run on the other. In this way, as long as each test is independent of the other you can safely run them in parallel at the same time even if it is not possible to run the same test in parallel at the same time (that is, if you can not run test on two Sockets at the same time, you might still be able to get an advantage of parallelism by running the Test B in one take during the tests in the other. See the online help for the type of step in autoscheduling for more details).

    (2) taken executions (and all executions of TestStand really) are threads separated within the same process. Since they are in the same process, the global variables in the dll are essentially shared between them. TestStand Station globals are also shared between them. TestStand Globals file, however, are not shared between runs (each run gets its own copy) unless you enable the setting in the movie file properties dialog box.

    (3) course, using index as a way to distinguish data access are perfectly valid. Just be careful that what each thread does not affect data that other threads have access. For example, if you have a global network with 2 elements, one for each grip test, you can use safely the decision-making of index in the table and in this way are not sharing data between threads even if you use a global variable, but the table should be made from the outset before start running threads , or it must be synchronized in some way, otherwise it is possible to have a thread tries to access the data, while the other thread is created. Basically, you need to make sure that if you use global data which the creation/deletion, modification and access in a thread does not affect the global data that the other thread use anyway in or we must protect these creation/deletion, modification and access to global data with locks, mutex or critical sections.

    Hope this helps,

    -Doug

  • Why the DLL function performed by call library node fails when the Vi is reopened?

    Development system

    OS: Windows XP

    LabVIEW: version 10.0

    DLL: Custom

    Compiler: Visual C++ 6.0

    Function prototype: __declspec (dllexport) const char * test (void)

    We have developed a DLL to use.  Compile the DLL itself.  The DLL includes a function test.  The test function validates the functional capabilities of the DLL.  I followed the examples online, and I used the tool to import shared library in LabVIEW.  The screw created use the call library node.

    When I create a VI by calling the function in the DLL test customized by using the call library node the VI runs the test DLL function flawlessly.  I close the VI.  When I re - open the VI and run it, I get an error code of the DLL.  However, if I go on the schema and define the path of the DLL in the library call Configuration node once again the VI then runs the test DLL function perfectly again.

    I have set the path of the DLL in the library call Configuration node everytime I open the VI.  The examples that I downloaded from the community don't require this.  What could be the missing DLL?  What Miss me?

    I solved the problem.

    I had create the DLL by using the following steps for VC 6.0:

    1. new project

    2. Select the Appwizard (DLL) MFC

    3. Select the regular DLLS using the MFC shared DLLS

    4 Yes for source file comments

    5 finishing

    The DLL must be on the VI search path.  The easiest way was to have the DLL in the same directory as the VI.

  • Missing when importing DLL functions

    Hi all

    I created a DLL using Matlab.  When I try to import in LabVIEW (version 8.6 or 2009), most of the functions don't appear.  Any ideas?  This has been done with Matlab R2010a.  I looked through other messages on the subject of Matlab DLL but they were all parties concerned to do anything to work at all.  In my case, certain functions through but not all of them.  I tried to attach files, but it wouldn't let me...

    Thank you and I hope that it is something really simple that I'm dominant.

    -Matt

    OK, I thought about it... This is an annoying problem of a Matlab (I think).

    The problem is that once you import the DLL (and I don't know exactly when) - you can not add more functions of the DLL.  So the first time I tried to do this, I had only one function.  Later, I added more - but they were simply ignored.  I have rebuilt (in Matlab) as a new project, imported from the DLL again, and the problem disappeared.

    It is also possible that it could be a problem of LabVIEW with the file lvlib (?) is not updated correctly, but I do not really - I know how to run now.

    -Matt

  • Hotmail account: I can't receive e-mail from addresses that are not already in my contacts list

    I can't receive e-mail from addresses that are not already in my contacts list, for example the library.  My account has been hacked recently, and I have informed Windows CE.  I then installed Avast security.  Since only known e-mail senders spend their emails.  Help, please.

    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    It seems that Avast is blocking messages from anyone not in your contacts list (much too tight fixed).  Disable the function of checking email and see if that solves the problem.  If so, run it without the option of e-mail enabled - it does not really help as long as you take normal precautions (as not to open attachments from people you don't know / trust and things like that).  If you don't know how to disable this feature, contact technical support Avast (I do not use the product so I don't know how, but it's probably under Options or something like that).  If this does not work, try to go to Microsoft Security Essentialshttp://www.softpedia.com/progDownload/Microsoft-Security-Essentials-Download-131683.html where I know that this problem is not happen and see if that solved the problem.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Problem of Sync of Smartphones from blackBerry - OpenFolder function failed

    I downloaded the Desktop Manager Version 4.6.0.12.  While trying to synchronize with 8320, I received an error message - intellisync "OpenFolder function failed" and nothing had synchronized.  How I overcome this problem?

    In addition, I would also like to know why the function to 'reconcile the messages' is not available in the Fund Manager and how I could reconcile messages from Outlook2007 to my unit so that all emails remain on the device and Outlook. Currently, I only get emails delivered to my blackberry only when my Outlook is closed.

    I am currently using the BIS.

    Thank you!

    OK giye that a test, restart and try DM

    http://www.BlackBerry.com/BTSC/search.do?cmd=displayKC&docType=kc&externalId=KB11703&sliceId=SAL_Pub...

  • I developed an Android application for a Digital Magazine with Digital Publishing Suite (Professional). Several weeks ago, I received this message from Google game: "we wanted to let you know that your app (s) listed below statically link against a versio

    I developed an Android application for a Digital Magazine with Digital Publishing Suite (Professional).

    Several weeks ago, I received this message from Google game: "we wanted to let you know that your app (s) listed below statically link against a version of OpenSSL that has several vulnerabilities for users. Please migrate your app (s) to a new version of OpenSSL within 60 days of this notification. From 07/07/15, game Google will block the release of new applications and updates that use versions older, not supported by OpenSSL (see below for more details). »

    I've updated the Android App using function Web app Designer, but they keep sending me this message. I don't understand what I have to do.

    Hi Sheila,

    If you connect to your Google game account, it will show you who sent you the warning to the apps. The generator on the web app produces Android apps which are not affected by this vulnerability.

    Neil

  • Apple Watch: can I receive all messages from whatsapp on my Apple Watch, but not the Group whatsapp messages, don't know why... Help, please. Besides, my watch is custom in Spanish, but only answer messages Whatsapp understands English... someone kn

    I can receive all messages from whatsapp on my Apple Watch, but not the Group whatsapp messages, don't know why... Help, please.

    Besides, my watch is custom in Spanish, but only answer messages Whatsapp understands English... anyone know why? Thanks to you all!

    Hello

    To change the language for a response on your watch: Press answer > firmly press the screen > press on choose language > select Spanish.

  • I received an email from my address, but not send it.

    I received an email from my email address, and the text was a phishing scam. I have not clicked on anything in the message. I ran my security software and found no problem. I'd do anything else? Thank you for your help.

    It is not uncommon for messages of spam and phishing to have a fake sender name and address because if you're spamming, you will not use your real information. The idea behind using your name and address as the sender, it's that you're not likely to block you.

    Of course, it is always prudent to consider whether someone might have actually gained access to your e-mail account, consider changing your password, but usually it's just a case of falsification of documents.

  • Received an email from MacPaw saying I could speed up my computer in El Capitan with their 5 steps. Worth it? Is MacPaw safe? Thank you.

    Received an email from MacPaw saying I could speed up my computer in El Capitan with their 5 steps. Worth it? Is MacPaw safe? Thank you.

    N ° report the message as spam or delete it. MacPaw is the author behind the scam "CleanMyMac.

  • Hello! I've received an email from Mr. dave britton

    Question
    Hello! I've received an email from Mr. dave britton (claim Director), indicating that im the winner in the INTERNATIONAL MOZILLA FIRE FOX and asking for some of my personal information. I don't really know what to do about this and I want to make sure if it is a cone or not! My email is [email protected]! Thank you for your time!

    It is a scam. Mozilla does not have a lottery to give money or have a claim Manager. Do not give your personal information. Many people get this kind of emails. Also, we do not use the international mozilla firefox name.

Maybe you are looking for