473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to call C APIs like CMC?

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
1 1318
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Sanyi Benczik | last post by:
Is there a standard way in C++ to call an external program or is this platform dependent? If it is platform dependent, can somebody drop a line what to use or where to look for info for GNU C++...
3
by: TC | last post by:
Hey Folks, I am using the following 4 Win32 APIs with a C# AddIn: FindWindow SetWindowLong SetForegroundWindow EnableWindow Within the AddIn, there are some winforms. I use these APIs to...
1
by: Siegfried Heintze | last post by:
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
2
by: ilyas | last post by:
Hi all I have a web service that I have written. It is written in C# I want to use this web service from a browser, but my users all have different browsers so its important that the code to...
15
by: Alpha | last post by:
I was told that Unix API can only be called using C++, ATL and MFC. However, I was also told that C# can do that through Pinvoke to a DLL that interfaces with the Unix API. Can someone direct me...
28
by: Peter Olcott | last post by:
I want to double check my understanding about how the .NET framework works. From what I understand every call to the .NET framework is ultimately translated into one of more API calls, is this...
4
by: Benny | last post by:
I am creating a thread via "new Thread(new ThreadStart(p.ThreadProc))", is it safe for ThreadProc to use GetMessage/TranslateMessage/DispatchMessage instead of DoEvents? What I would like to do...
1
by: comp.lang.python | last post by:
Hi, I am using some TCL driver APIs and user define TCL function to control a traffic generator. The APIs are the traffic generator's specific and in built to the driver library. The issue is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.