473,398 Members | 2,380 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,398 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 1319
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.