Jump to content

mooner

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by mooner

  1. I'm having problems again and now I like to come here for help. I'm currently doing something about 3D measurements and this is something I'm not familiar with. My question is how to fit a plane using multiple coordinates and calculate the distance from any point to the plane?Is there a corresponding module and example for LabVIEW?
    I don't want to use a third party tool, that costs too much
     

  2. Sorry it's been so long! I'm not sure what the problem is with this one. This source code was given to me by someone else. Then I made a new copy of it and I don't have this problem anymore. Anyway, this is not a typical problem, so please ignore it. Thanks to Rolf for his patience in answering this question, it more or less taught me something.

     

  3. I have installed win10 in a virtual machine and the development environment is LabVIEW 2018, when I finish coding and ready to package to generate EXE file it reports an error. Can anyone give me some hints as to why this is? (The program works fine in the development environment. DAQNavi.dll, this is an io card related DLL, I have installed his driver)

    error.PNG

  4. 6 hours ago, Rolf Kalbermatter said:

    What does the documentation say about the pointer returned by the function? Is it allocated by the function? Is it a static buffer that is always the same (very unlikely)?

    If it is allocated by the function, you will need to deallocate it after use (after the MoveBlock() function), and the documentation should state what memory manager function was used to allocate the buffer and what memory manager function you should use to deallocate it, otherwise you create a memory leak every time you call this function.

    Ideally the DLL exports a function that will deallocate the buffer, still a usable solution is if they use the Windows GlobalAlloc() function to create the buffer in which case you would need to call GlobalFree(). Pretty bad would be if they use malloc(). This is because the malloc() call that the DLL does might be linking to a different version of the C runtime library than the according free() you will try to call in LabVIEW, and that is a sure way to create trouble.

    Thanks for the heads up! Indeed the program was running with a memory leak. My code also needs to call the function where the DLL frees the memory. I tested it and the modified program does avoid the memory leak problem.

    free.PNG

  5. On 10/24/2023 at 1:04 AM, dadreamer said:

    And what's the image data type (U8, U16, RGB U32, ...)? You need to know this as well to calculate the buffer size to receive the image into. Now, I assume, you first call the CaptureScreenshot function and get the image pointer, width and height. Second, you allocate the array of proper size and call MoveBlock function - take a look at Dereferencing Pointers from C/C++ DLLs in LabVIEW ("Special Case: Dereferencing Arrays" section). If everything is done right, your array will have data and you can do further processing.

    Thank you very much for your reply. After your guidance, I re-learned the use of "MoveBlock" and found that this function is indeed a very powerful thing, and I have solved my problem by using it so far. Attached is a screenshot of my code, thanks again!

    code.PNG

    frontPanel.PNG

  6. On 10/23/2023 at 6:49 PM, Neil Pate said:

    I am definitely not an expert on this kind of stuff, but I think you would first "create" a datastructure big enough to hold your image in LabVIEW. The type does not actually matter as long as it is big enough (1 byte * width * height) and then pass that into your DLL call as the first input parameter, followed obviously by the width and height.

    After the DLL call the data should now have been copied into that datastructure (i.e. the wire itself will have the image on it).

    I get easily confused with pointers to pointers, so might have this completely wrong.

    Sorry I have not explained this very well. Can you attach your DLL?

    Thank you, your explanation is very clear. I have solved my problem so far and the solution is basically the same as you said.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.