Solved

garbage collector VB.NET

Posted on 2004-03-24
3
723 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

808 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