This C++ code worked for me so far:
Main.cpp:
unsigned __int16** image_data; image_data = Grabber->get_image_data(1); interface.cpp:
unsigned __int16** Grabber::get_image_data(int image_num) { unsigned __int16 **pixel_values = 0; pixel_values = new unsigned __int16*[height]; for (int h = 0; h < height; h++) { pixel_values[h] = new unsigned __int16[width]; for (int w = 0; w < width; w++) { pixel_values[h][w] = ...; } } return pixel_values; } But now I would like to pass the array as pointer to the function. I tried it like in following code, but it doesnt work anymore.
Main.cpp:
unsigned __int16** image_data; Grabber->get_image_data(1, &image_data); Interface.cpp:
int Grabber::get_image_data(int image_num, unsigned __int16*** image_data) { *image_data = new unsigned __int16*[height]; for (int h = 0; h < height; h++) { *image_data[h] = new unsigned __int16[width]; for (int w = 0; w < width; w++) { *image_data[h][w] = ...; } } return 0; } Are there any errors in reasoning by me?
__int16*), and manually calculate the index. Better still, usestd::vector<int16_t>, which utilizes the standard typedef and automatically manages its memory.