The library is certainly making poor use of typing.
I would have expected
CAEN_DGTZ_MallocDPPWaveforms to have passed
CAEN_DGTZ_DPP_PSD_Waveforms_t ** rather than void **.
Also, the Waveforms member of the
CAEN_DGTZ_DPP_PSD_Event_t struct is declared as
uint32_t *Waveforms;
This states that Waveforms is a pointer to an int32_t. While that could be true, it seems more likely that it it really a pointer to
CAEN_DGTZ_DPP_PSD_Waveforms_t and should have been declared as
CAEN_DGTZ_DPP_PSD_Waveforms_t *. Hopefully, the library is using that a "generic" pointer type (and recasting it internally) and not storing the adddress of the waveform information in the int32 pointed at as that would case a problem since pointers in your environment are 64 bits.
When you say you're using
reinterpret_cast, I'm assuming something like this?
1 2 3
|
void * vp_events[MAX_CH];
CAEN_DGTZ_MallocDPPEvents(handle,vp_ events, &AllocatedSize);
events1 = reinterpret_cast<CAEN_DGTZ_DPP_PSD_Event_t **> vp_events;
|
When you say the "device is not configured correctly", can you give more specifics?
You should certainly be able to pass vp_events back to the corresponding free routine without recasting, assuming it's expecting void ** also.
BTW, the description of those params is incorrect.
1 2
|
param [IN] waveforms
param [IN] events
|
Those should be described as [OUT], since the results of the malloc calls are stored in the supplied pointers.
edit: I've found C++ compilers forgiving of passing typed pointers to a function that takes a void * (as expected), but they don't seem to like typed pointers to pointers as in your situation. Perhaps someone more knowledgable might have an explanation.