Calling any function from dll throws error

0

I'm making game engine in c++ which is compiled into dll. For last 2 weeks i was doing very boring cleaning of code to make it easier to use, unfortunantely didnt make any backup. Now when i put call to any function from that dll inside executable code it shows error window, when executable starts, which tells error code 0xc0000142. Compiler doesnt show any warning that could lead to this, no linking error, nothing. I have no clue what could do this. I'm using linker to link dll instead of loading it dynamically. Does anybody know what can trigger this error?

c++
windows
visual-c++
dll
asked on Stack Overflow Jul 25, 2020 by Michaelt LoL • edited Jul 26, 2020 by Amit G.

2 Answers

2

if not delay-load, when you load the process, the dll will also be brought to memory. so this error happens. How to tackle? I suggest you to make a fresh plain executable with just basic code and insert this dll. try it. if successful, insert a function call on a non-functional code (should not be called on startup) and try it. if the above succeeds, try to add the function call on functional code and try it. if works means simple DLL is clean. Then what happens to your original exe, there is a good chance that the a bad copy of DLL is placed in PATH. it is causing the error.

if anything fails in between, you can figure out the issue from DLL. in that case, I suggest you to comment out all code with a fresh blank function. DllMain way next.

sorry for the 'open ended' answer. but for debugging I think you need some pointers to think. you are the one ultimately going to find the result. please post the findings.

answered on Stack Overflow Jul 26, 2020 by veenus adiyodi
0

Good. Usage of exception is good in scenarios like construction. It does not add much performance overhead when things go well. But neat when nasty things happen. especially good when you give the code to others to maintain.

answered on Stack Overflow Jul 27, 2020 by veenus adiyodi

User contributions licensed under CC BY-SA 3.0