Calling C# dll from existing native application

J

Jan Lindh

Hi
Is there a preferable way to write a C# dll that should be called from an
existing application (running native code).

It is not possible to change this application and its source code isn't
available.

The dll performs the communication beteween the computer and a external
device (using a RS232) line.

The dll should have a few enties .
for example one looks like this
Bool Init(struct1* a, struct2* b);

From the application does the dll receive pointers to a structure
constisting of
- strings
- function pointers
- Bool, int..

The function pointers should be called from the dll (call backs), sometimes
on external events.
Some data (strings...) should be inserted by the dll into the application
structures.

What is the best way to do this?
The solution should be maintainable for the future as well.

Jan Lindh

The old school solution would to write the entire dll in normal C++.....
 
N

Nicholas Paldino [.NET/C# MVP]

Jan,

The only way to do this would be to create a native dll in C++ which
would make the appropriate calls to managed code. C# cannot export
functions from assemblies.
 
W

Wolf Saenger

Create a ActiveX Facade.
Jan,

The only way to do this would be to create a native dll in C++
which would make the appropriate calls to managed code. C# cannot
export functions from assemblies.
 

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