LoaderLock managed exception when using ipps API within a c++/cli dll
We have just ported to IPP 6.1, and had to update the deprecated ippiResize to ippiResizeSqrPixel. However, when we added the code to allocate the buffer (ippsMalloc, ippsFree), at runtime debug we get the LoaderLock exception warning that: "Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang." It's worth mentioning that before this update our code did not use or link ipps library.
I imagine this is related to the managed class that calls our c++/cli class which uses the ipps functions. But I fail to understand why initializing ipps cause this issue.
- I did not find any documentation of this issue. - Calling ippi, ippcv, ... libraries has no issues with managed/unmanaged communication.
The ippsMalloc/ippsFree only call system malloc/free funtions, and pad the memory to 32 byte alignment. As a wordaround, can the following code work for you? It just call system malloc function, and make the memory address alinged to 32 bytes.