c++ - Why am i getting "LoaderLock" detection? -
i calling c++ dll (not code) c# code using p/invoked loadlibrary api. when run application, loaderlock error being detected.
at first blame dllimport c# wrappers this, when try load other c++ dll, works fine.
i've read articles online regarding loaderlock , seems #1 rule not funny inside dllmain. , when checked c++ dllmain calling apis in dll_process_attach , dll_process_detach.
bool apientry dllmain( handle hmodule, dword ul_reason_for_call, lpvoid lpreserved ) { switch (ul_reason_for_call) { case dll_process_attach: startapi(); break; case dll_thread_attach: break; case dll_thread_detach: break; case dll_process_detach: exitapi(); break; } return true; }
when checked startapi(), has big chunk of code , calls function creates proccess using createproccessa
is real reason why im getting loaderlock error?
i told startapi() should run upon initialization of dll, there other way make work?
i planning call startapi() in thread, i've read creating thread inside dllmain recipe disaster.
thanks!
wiki
Comments
Post a Comment