I'm trying to use a 3rd party dll in cpp but am having some issues with using vector. I am reasonably experienced in using c but have never really looked at cpp before a week ago, so using vector is new to me. My aim to to create a dll around this dll which I can use in usual environment, c (more precisely CVI/LabWindows)
The help file gives the following info about the member I'm trying to use:
GetSequentialImages (std::vector< CImage< image_t > > &tab_image)
-Acquires a sequence of images, and copy them into a previously allocated image array.
I have scoured the SDK docs and there is no way of setting the number of images to get, so I presume it is determined by the size of the vector.
So I have tried to create and size a vector using the following code, which crashes. Without the resize(), the member appears to do nothing.
You don't need to reserve and resize the vector. This is done automatically when inserting elements into the array. Pre-reserving does make sense if the images are big.
I'm pretty sure this is taken care of in the SDK. Forgive my lack of cpp speak, but from what I can gather, there is a <template > class that allows use of a few different types of CImage<> containers. There are 8, 16 and 32 bit types. I think the SDK 'inherits' these from the boost libraries.
You don't need to reserve and resize the vector. This is done automatically when inserting elements into the array. Pre-reserving does make sense if the images are big.
from the SDK docs:
-Acquires a sequence of images, and copy them into a previously allocated image array.
So the member needs an pre-allocated array. From my experience in c I would assume this means the .size needs to be 5 (or whatever the # of images is). - besides, the member needs to know how many images i want and this is the only that I can see to tell it how many.
I've directly contacted the supplier of the SDK about this. It's still a work in progress but the main problem was that allocating memory for a CImage dosent allocate pixel memory, this has to be done separately and then a pointer to this pixel memory placed in the CImage container.