Jump to content

Search the Community

Showing results for tags 'wrapper'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Software & Hardware Discussions
    • LabVIEW Community Edition
    • LabVIEW General
    • LabVIEW (By Category)
    • Hardware
  • Resources
    • LabVIEW Getting Started
    • GCentral
    • Code Repository (Certified)
    • LAVA Code on LabVIEW Tools Network
    • Code In-Development
    • OpenG
  • Community
    • LAVA Lounge
    • LabVIEW Feedback for NI
    • LabVIEW Ecosystem
  • LAVA Site Related
    • Site Feedback & Support
    • Wiki Help

Categories

  • *Uncertified*
  • LabVIEW Tools Network Certified
  • LabVIEW API
    • VI Scripting
    • JKI Right-Click Framework Plugins
    • Quick Drop Plugins
    • XNodes
  • General
  • User Interface
    • X-Controls
  • LabVIEW IDE
    • Custom Probes
  • LabVIEW OOP
  • Database & File IO
  • Machine Vision & Imaging
  • Remote Control, Monitoring and the Internet
  • Hardware

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Company Website


Twitter Name


LinkedIn Profile


Facebook Page


Location


Interests

Found 3 results

  1. Hello I hope someone can help me, I have been trying to get this to work for days but no success yet. What I want to do I got a dll with a wrapper, this dll and wrapper can be used for a special datalogger. The wrapper contains multiple functions, I have got some of them working using a CLFN, for instance I can read a jumper setting from the datalogger in LabView. So far everything is fine. Of course I am not that interested in the jumper setting, I would rather use the datalogger to log data. I need to run one function to start logging. When there is enough data in the databuffer of the driver dll it will call a callback function I need to write in Labview, here is the function which starts the logging as described in the header file: Int LOGEXPORT __sdcall LOG_StartLogging{const char ** logFilename, ptLogCallbackfunction ptFunction, ptObject ptObject} logFilename needs to be a NULL pointer, from my understanding I do not need to do anything with it. Only provide it. If I do not do anything with it some data is saved at a default location. ptLogCallbackfunction, as far as I know I need to provide a pointer to the callback function ptObject ptObject, this must be a void pointer The header also provided how the callback function could look like in 😄 Void __stdcall callbackLog(ptObject object, const int ArraySize, const StructLogdata *const logDataArray) { // copy data from logDataArray for use in my code } StructLogdata is a struct with different datatypes. What I did try I did a search on internet there are some examples about callback functions, most of them point to NET and active X. They use a reg Event Callback. I did read the helpfile at the end of the helpfile there is the text: “Use the Event structure or the Register For Events function to register and handle non-.NET or non-ActiveX events dynamically” I am having a hard time to find a proper example. I did find this site with some information: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8XJSA0&l=nl-NL and this one about the refnum: https://forums.ni.com/t5/LabVIEW/Passing-Event-Refnum-to-Call-Library-Function/td-p/4107748 So I did make a user event, I wired a static Vi ref containing a callback vi to the input of this user event. I did wire the user event to a Reg event and wired the event registration refnum to the start logging dll call library function node function pointer input and also to an event structure. I did place a counter in the event structure. But nothing happens besides for an exception which makes Labview crash. The parameters I did use in the call library function are: logFilename: type numeric, datatype: Signed Pointer-sized int Pass: pointer to value ptLogCallbackfunction: type: adapt to type, Data format handles by value (tried all options) ptObject: same as logFilename I did try a lot of different things. Writing them in this post will result in chaos and I don’t want that. I hope someone can help me with a simple example how to make this work, or point me into the correct direction. Thank you all for the help!
  2. Hi everyone. I wrote wrapper in Visual Studio for OpenCV calibrateCamera() function. Every operation like converting 1D array of points to vector<vector<Point2f>> etc, works ok, except most important thing. When function ()calibrateCamera is called, LabVIEW crashes. When this line is commented out, dll works ok (at least labview is still alive). Im out of ideas. I suspect that this is problem with memory management but i dont have an idea where it cames from. Function do not operate directly on data passed from LabVIEW. Ultimately I can compile code as exe and call it via cmd, but I'm curious why such a thing appears. Thanks for your precious time! Zyga dll source (if you need i can enclose some sample input data): #include <opencv2/core/core.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <extcode.h> using namespace cv; using namespace std; static void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f> &corners); static void arr2vect(float *APoints,int *Asize, vector<vector<Point2f>> &imagePoints); extern "C" { float __declspec(dllexport) Calibrate(float *APoints, int *Asize, int width, int height, float squareSize) { //initialize variables vector<vector<Point2f>> imagePoints; Size boardSize; boardSize.height = height; boardSize.width = width; Mat cameraMatrix = Mat::eye(3, 3, CV_64F), distCoeffs = Mat::zeros(1, 1, CV_64F); cameraMatrix.at<double>(0,0) = 1.0; vector<Mat> rvecs, tvecs; vector<vector<Point3f>> objectPoints(1); Size imageSize; imageSize.width = 2040; imageSize.height = 2040; arr2vect(APoints, Asize, imagePoints); // prepare imagePoints calcBoardCornerPositions(boardSize, squareSize, objectPoints[0]); //prepare objectPoints objectPoints.resize(imagePoints.size(),objectPoints[0]); //calibrate double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs); return rms; } } //definitions static void arr2vect(float *APoints,int *Asize, vector<vector<Point2f>> &imagePoints) { int page = *(Asize); int row = *(Asize+1); int col = *(Asize +2); Point2f pointBuf; vector<Point2f> vectBuf; for (int i = 0; i<page; i++) { for (int j = 0; j<row; j++) { pointBuf.x = *(APoints + (i*(row*col))+j*2); pointBuf.y = *(APoints + (i*(row*col))+j*2+1); vectBuf.push_back(pointBuf); } imagePoints.push_back(vectBuf); vectBuf.clear(); } vectBuf.clear(); } static void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f> &corners) { corners.clear(); for( int i = 0; i < boardSize.height; ++i ) for( int j = 0; j < boardSize.width; ++j ) corners.push_back(Point3f(float( j*squareSize ), float( i*squareSize ), 0)); }
  3. Hi guys, I have a wrapper to a DLL which was written in C, now the DLL used from the wrapper was updated to a new version, so I have to reload the DLL into the "Call library function" for each function of the wrapper that I've already created and it is a very boring job. Therefore, I would like to know if exists a trick to use to update all functions of a dll wrapper in one shot? Does it exist?
×
×
  • Create New...

Important Information

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