08-19-2019 11:14 AM
Hi,
I need to export my labview inspection to dll. After building the dll, I tried to run it in c++ but it failed with "Not an Image" error. I simplified it to following code:
Image* img = imaqCreateImage(ImageType::IMAQ_IMAGE_U8, 0); imaqReadFile2(img, "C:/Users/irt/Pictures/5_p_47356.jpg",NULL, NULL, NULL); auto err = NI_Vision_Development_Module_IMAQInverse((uintptr_t*)img);
It fails with the same error.
What i'm doing wrong?
08-20-2019 09:01 AM
I'm not sure if I have ever tried what you are doing, or if it is even expected to work. Under the hood, the LV image type is sort of a super-set of the C API image type (it adds a layer of the LV refnum and a name). You should be able to transparently pass a LV image to the Vision C API functions, and when the refnum is cast into a pointer-sized integer on the LV diagram, it should be the same type as an Image* (as far as I recall). Going the other direction seems tricky, since any place the image needs to be translated back to a refnum, it won't have an associated LV data structure allocated.
Have you tried creating the images from LV first, then passing them to your DLL (moving IMAQ Create out of your DLL and onto the LV diagram)?
Eric
08-27-2019 02:26 AM
We solved it by wrapping the inspection SubVI by an adapter. C++ gives a pointer to image data, height, width and stride to LV (see VIs below).