Using UnManaged Code in Managed code

U

Usman Jamil

Hi

I've a COM written in VC++ 6, and i'm using it in a C# project. I add the
Com reference in the refrences and in a method of a class of C# code, I
instantiate the COM object. Since this object is local to the function so it
should be distroyed as its scope finishes i.e. as the function body
finishes. and when the COM object destroys, its FinalRelease should be
called. I've written some cleanup code in this FinalRelease. that is
important to be executed on its release. But the problem is that the object
does not get destroyed here, rather it is destroyed when that C# application
ends. and then the FinalRelease is called. To make things worse, this C#
application is a non-stopping server type of application that does not get
exited, so the Object never gets released. It only gets released when I stop
this server manually. I want this FinalRelease to be called as soon as the
body of the C# function containing this object finishes. Is there any way I
can do this.

Please Help.

Thanx and Regards

Usman Jamil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top