I have this function, written in unmanaged(native) C++. I need to call that function from within a .NET application. As I understand it, the only way to accomplish this is to use p/invoke. The only problem is that this method is meant to be added as part of an existing C++ app, so it isn't really designed to go into a .dll. You have to have(I think) your code in a dll to call it from .NET.
I tried creating a C++ dll several ways, but none worked. Anyone have any other ideas?
Thursday, June 16, 2005
Subscribe to:
Post Comments (Atom)
4 comments:
#pragma unmanaged
Can you give me an example of how you do that? Does it only work in a managed C++ class, or can I use that in a C# class? Some sample code would be great
Can't paste the code in the comment, so heres a link to the sample from MSDN...
http://msdn.microsoft.com/library
/default.asp?url=/library/en-us/vclang
/html/vcerrManagedUnmanaged.asp
And it's a #pragma, so it's only for C++. C# is another matter, the only way I know of is to create a managed wrapper around the C++ code or use platform invoke.
Post a Comment