I’ve browsed through the forums, and I understand there’s rarely (if at all) a need to use new and delete keywords within UE. However, I’m trying to do something very uncommon and would appreciate any help / tips in this scenario:
I need to call a dll function that takes in several float pointers (all declared and set to nullptr within my code).
The dll function allocates memory to those passed pointers (using new[]) and then assigns their value.
When the function returns, the passed pointers are now populated with values, I use those values (floats) and assign them to my class variables.
At the end of that, I need to call delete[] on the pointers that were passed to and allocated by the dll.
All of this happens within a single local scope - one of my class’ function.
When i call delete[] I get an Access Violation crash.
Since the dll explicitly requires non-const float*&, I need to use raw pointers and call delete on those at some point. The dll is a generic, third-party dll that is independent from UE, and i’ve used the approach below with the same dll in other software (not UE) and works as expected.
Here’s some pseudo code:
float* floatArr = nullptr;
CallMyDLL(floatArr);
myFloatMemberVar = floatArr[0];
delete[] floatArr;
I’ve read unreal has it’s own implementation of the delete, which I believe is what is getting in the way.
Any help or pointers (pun-intended) would be greatly appreciated!!