By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,640 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

How to call C APIs like CMC?

P: n/a
How do I call APIs written in C like CMC? Will PInvoke do the job? I hope I
don't have to write a COM wrapper!
Sieg
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Platform Invoke ([DllImport]) is used to call *any* function exported from a
DLL. All functions exported from a DLL are C functions (yes, you can put
__declspec(dllexport) on a C++ method, but it will be exported as a C
function hence you have to take into account C++ name mangling and the this
pointer).

If the function is available through a static library then you can only
access the function through managed C++. In this case the managed C++ code
simply calls the function - you don't need any other code.

The COM wrapper objects are only used when you want to call COM code from
..NET code, or if you want to use .NET code from unmanaged code.

Richard
--
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
"Siegfried Heintze" <si*******@heintze.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
How do I call APIs written in C like CMC? Will PInvoke do the job? I hope I don't have to write a COM wrapper!
Sieg

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.