call c# dll in c++, both in VS2005

H

hjhaas

Hallo,

I've written a dll in c# and latest VS2005 for WinCE on Pocket PC. My
main programm is running in c++ in VS2005 too.
How can I call the functions in the c# dll with my c++ application?
Com objects seems not to be supported, or I'm wrong?

Is there an easy way to call c# and c++ functions inside VS2005 with
the compact framework?

Thanks for your help!

HJH
 
P

Paul G. Tobey [eMVP]

No, you can't host managed run-times from unmanaged code. That's what you'd
be doing with trying to host a C# DLL from unmanaged C++. You can do things
the other way around, calling C/C++ DLLs from C#, or you can write the main
program in C#, not C++, but you can't do what you're trying to do there.

You might be able to make the C# DLL into an EXE and arrange some means of
communications, inter-process, between your C++ program and the C# program,
but there's no direct fix.

Paul T.
 
H

hjhaas

Thanks for Your answer, but are You really sure?
How about COM-Objects? The difficulty is to register the object in the
WinCE environment. Is there any solution for this? Regsvrce seems not
to work.

Thanks for any hint or suggestion!

HJH
 
H

hjhaas

I can't believe it!

Here is another Url, that says that it IS possible with COM Objects.

http://blogs.msdn.com/netcfteam/

You can't register the Com in the registry but on runtime. So, you have
to start in c#, register the interface and call the c++ code, that
calls the c# code.
But I don't understand the phrase: "use the runtime to marshal a
managed interface or a delegate down to native code".

Can anyone explain me this?

Thanks for your help!

HJH
 
P

Paul G. Tobey [eMVP]

You *can* write your COM objects in *native* code and call to them from
managed code. You can't do the opposite, however.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top