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 / May 2004

Tip: Looking for answers? Try searching our database.

unmanaged old static library, how to call its functions from managed code in Win Forms, VC++ ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
andrea catto' - 04 May 2004 19:47 GMT
Yes I did some research on google but nowhere I could find a working
example.

I have a header file and its .lib/static library.

I'd like to design an UI application using Windows Forms which seems cool
but..........

I can NOT call a regular unmanaged static library's method.

it tells me in fact those methods don't have the _gc (garbage collection
method).

IJW ??? is that the answer ???

do I have to specify another #pragma somewhere ???

I can not modify the header file or the library.

and if possible I don't want to create wrapper functions for all those
apis..
Anthony Moore - 10 May 2004 20:02 GMT
There is no way to call these from managed code without some minimal sort
of re-definition or wrapper. The simplest ways to call your old code:
1. Recompile the library with managed C++ and use _gc classes.
2. Create managed C++ wrapper classes for the library functions.
3. Use P/Invoke to call C-style functions directly. For this, you must get
the library compiled into a DLL.

I would recommend the 2nd option here.

--------------------
| From: "andrea catto'" <acatto@dataflight.com>
| Subject: unmanaged old static library, how to call its functions from
managed code in Win Forms, VC++ ?
| Date: Tue, 4 May 2004 11:47:05 -0700
| Lines: 23
[quoted text clipped - 7 lines]
| NNTP-Posting-Host: 208.201.80.28
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.clr:10494
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
[quoted text clipped - 20 lines]
| and if possible I don't want to create wrapper functions for all those
| apis..

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.