Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / September 2003

Tip: Looking for answers? Try searching our database.

Access Managed Object From Unmanaged Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce Farmer - 06 Sep 2003 03:06 GMT
I am having problems accessing a managed object from
unmanaged code.  Specifically, I have a .NET forms
application with a web service proxy.  The forms
application links to an unmanaged DLL which uses callbacks
to receive data via TCP.  The data received in the
callback must be passed to a web service via a web method
provided by the proxy.  So the callback (which is
unmanaged code) needs to access the proxy (managed object)
to send the data to the web service.  I am able to pass a
pointer to the proxy into the unmanaged callback using
pinning pointers and am able to invoke the web method to
transmit the data.  The problem with this approach is that
it results in memory leaks, I assume because the CLR
garbage collection is not taking place in the unmanaged
code.  Any suggestions of how to correct this or sample
code for a similar scenario whould be much appreciated.
Sonja Keserovic - 30 Sep 2003 23:06 GMT
Bruce, you are right about GC not tracing unmanaged memory. You are
responsible for taking care of that manually (or in cases of COM objects
we'll make sure they are released appropriately). Do you have similar
working scenario that is unmanaged? What would you do there to release
memory?

In case this is not helpful, could you be more specific about your
managed/unmanaged transition? Is your managed language C# or something
else? Is your unmanaged DLL exposing COM API or flat API? How does callback
signature looks like?

Thanks,
Sonja Keserovic
CLR Program Manager

--------------------
>Content-Class: urn:content-classes:message
>From: "Bruce Farmer" <bfarmer@swri.edu>
[quoted text clipped - 32 lines]
>code.  Any suggestions of how to correct this or sample
>code for a similar scenario whould be much appreciated.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.