Solved

garbage collector VB.NET

Posted on 2004-03-24
3
720 Views
Last Modified: 2012-08-13
How can i avoid garbage collector releasing the delegate function's address. By default, the GC is on. I've no control over GC. When i pass the AddressOf callback funciton to an unmanaged DLL, the address is lost as soon as the function passing the address of the callback returns. each time the address is a new and when there is a mis-match between the calling address and the actual address, the applicaition faults.

regards

pawan

0
Comment
Question by:pawan_marwar
3 Comments
 
LVL 6

Accepted Solution

by:
KarunSK earned 100 total points
ID: 10669669
You have to use GCHandle methods to do this. Typically, you create a handle to the managed object using GCHandle.Alloc(), and pass this handle to the unmanaged DLL.

Here is an example from MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcongchandlesample.asp

HTH,
Karun.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now