Question

I have a problem when I link to a DLL I created. The exception thrown is Unhandled exception at 0x000007FA17461069 (ntdll.dll). The strange thing is that this only happens if I link the DLL in a win32 application but NOT in a win32 Console application. The problem seems to be something that deals with thread creation.

The call stack is as follows:

msvcr110d.dll!_callthreadstartex() Line 354            C
msvcr110d.dll!_threadstartex(void * ptd) Line 337      C

The DLL contains implementations for the ACE proactor framework, using the operating systems I/O completion ports. It runs fine in a console application, but not in a win32 windowed application.

Any help would be appreciated.

EDIT: as requested by comments below:

The line of code that throws the exception is ACE_Service_Config::open(GetCommandLineA());

I use the ACE Configuration framework to so I load my DLL dynamically with a svc.conf file. This is the only line of code that needs to be written to the main function of the console program.

I tried writing this line after the WM_CREATE message is caught. It crashes.

Was it helpful?

Solution

When you create a console application ACE will redefine main to make sure it gets correctly initialized. When making a win32 windows application this trick doesn't work. You have to call ACE::init() and ACE::fini() yourself, see ACE_wrappers/tests/ACE_Init_Test.cpp for an example how you can do this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top