all groups > dotnet interop > july 2003 >
You're in the

dotnet interop

group:

destructor in c++ app opened from c# app


destructor in c++ app opened from c# app Troels
7/11/2003 4:37:39 AM
dotnet interop:
Hi.=20

I'm developing a C# app which is starting another, old,=20
c++ app using the Proces class in .NET. I have a problem=20
with the C++ app.=20
In the destructor of the c++ app, some methods is called=20
to free some external resources to some POS hardware=20
through OPOS. But this destructor does not seem to be=20
used when i do one of the following things:=20
1. Call the Kill() of the proces class=20
2. call the Close() on the proces class=20
3. call the dispose() on the proces class=20
4. call the CloseHandle(IntPtr handle) of the Kernel32=20
5. pres ctrl+alt+del and kill the proces manually.=20

no matter what i do it seems that the destructor of the=20
c++ app is never called.=20
Can this be true?=20
Re: destructor in c++ app opened from c# app Mattias Sjögren
7/13/2003 3:02:30 AM

[quoted text, click to view]

Well if you kill a process it doesn't get a chance to do cleanup work.
If you want it to clean up properly, don't kill it.


[quoted text, click to view]

Neither of these should terminate the process.


[quoted text, click to view]

Do they run when you launch the app in another way (from command line
or Explorer for example). If not, why do you think this is
framework/C# related? Perhaps you should post to a C++ group instead.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
AddThis Social Bookmark Button