DllImport question

R

Rookie

Hi,

I was trying to link a UI I made in C# to the backend which is coded
as a DLL in VC++.

I used the DllImport attribute to invoke the dll functions. Is there
any similar mechanisms by which I can invoke member functions of
classes defined in the dll?

Is there any way I could instantiate an object of a class defined in
the dll?

I am new to C#/dll's et al so I am not too sure if these questions
make sense. But if anyone can provide some info on this and more
importantly provide pointers to articles/examples on these topics it
would be a tremendous help.

Thanks.
 
K

Klaus H. Probst

Only if you expose the classes as managed objects. In VC++ 7.x you can do
this, but beyond simple calling of exports in DLLs C# will not talk to
anything that is not a managed library. That means you'd have to put a
wrapper around your C++ classes.

It's the same approach as COM, basically. VB6 could not talk to C++ classes
unless they were exposed somehow through COM.
 

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