c++ msvc: application crashes after exit (only visible in event viewer)


I'm C++ noob. I created a small, very basic cli tool to access a 3rd party legacy 32-bit dll. The tools works and I get the correct values returned. At first I did not notice it but then in the windows event viewer I saw many error entries caused by this tool. They only seem to happen after the exit code is already returned.

The exception code is 0xc0000005 (Access violation, right?) and it's causes by the dll (Faulting module name).

Main part of my code is this:

typedef long (__cdecl *f_myFunc)(const char* smi, float_t &logi, long &numContrib, handle_t &contrib);

int main(int argc, char *argv[], char *envp[]) {
    HINSTANCE hGetProcIDDLL = LoadLibrary("/path/to/dll")
    f_myFunc myFunc = (f_myFunc)GetProcAddress(hGetProcIDDLL, "myFunc");
    //use myFunc multiple times

    return 0;

The error happens exactly one per application run. The application itself reads a file and calls myFunc once per row in the file.

So my question is what am I not cleaning up properly that causes this error?

asked on Stack Overflow May 6, 2020 by beginner_ • edited May 6, 2020 by beginner_

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0