Atozed Forums

Full Version: ISAPI DLL C++ Builder Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Howdy All!

First, I hope everyone and their families have had a WONDERFUL and SAFE holidays!

I have a problem with my statically linked IW ISAPI DLL.

When the ISAPI dll is unloaded, after all else is released, I get an EAccessError on the final unload of the DLL in the exit code (Delphi).

I know what is causing the issue as I have had the same issue in my statically linked EXEs over the years: NexusDB memory manager. 

NexusDB has stated that the NexusDB memory manager is only meant to be linked with 'Use Packages' in C++ Builder which is a BAD idea for my customers (and thus my sanity). I can't not use the NexusDB memory manager because it is used by NexusDB.

In my EXEs, I just call ExitProcess() in my main form's deconstructor after I know I have closed all connections and released all other resources I use.

Does anyone know how to do an equivalent when the DLL gets a DLL_PROCESS_DETACH message?

Thanks in advance and Happy New Year!

Shane

P.S. Update it turns out that ExitProcess(1) works out well in the DLL_PROCESS_DETACH also!
Hi Shane!

So, if I understood correctly, NexusDB MM is not being used, correct?

My other question is: why do you call ExitProcess() yourself? IIS working process (w3wp.exe) is the one responsible for terminating your DLL in a controlled way. ExitProcess() bypasses most of the finalization code and there is no way to guarantee that the application will terminate correctly.
(12-29-2019, 01:14 AM)Alexandre Machado Wrote: [ -> ]Hi Shane!

So, if I understood correctly, NexusDB MM is not being used, correct?

My other question is: why do you call ExitProcess() yourself? IIS working process (w3wp.exe) is the one responsible for terminating your DLL in a controlled way. ExitProcess() bypasses the most of the finalization code and there is no way to guarantee that the application will terminate correctly.
Howdy Alexandre!

I am NOT using the NexusDB memory manager but since I link in NexusDB components, they do.

If I don't call ExitProcess(0) from within my DLL Detach event, my IW ISAPI DLL will EAccessError in the NexusDB cleanup code. Most of the time IIS will recover my app, other times it will not. 

By my using ExitProcess(), it seems IIS ALWAYS recovers!

All the best,

Shane
Hum... i see. So, your ExitProcess() "works" because it skips NexusDB finalization code (which raises an exception).

And according to your first post, NexusDB requires you to use packages and that's why it fails on termination. Isn't possible to just skip the specific part of NexusDB code so it won't raise an exception?
Other than that, isn't possible for them to just fix the product?
Howdy Alexandre!

Correct! I only call ExitProcess() after IW and I release all known used resources.

NexusDB says the answer to the C++ Builder issue is to link with packages .... I found ExitProcess() to be a better answer!

All the best,

Shane