Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to wrap a C++ class in a C based dll or a CLI based dll?
    primarykey
    data
    text
    <p>I am told to import my writen class in C++ into a dll and then use that dll in a c# application. Following <a href="https://stackoverflow.com/questions/4555961/how-to-use-a-class-in-dll">this guide</a> I created the dll, but I can't simply use it in a C# application since there are some issues concerning it: </p> <ol> <li><p>What should I place for the return type of my factory function? </p></li> <li><p>What is the equivalent of <code>const wchar_t*</code> which is my constructors argument type?</p></li> <li><p>How can I retrieve and use my functions return type which is of type <code>vector&lt; wstring&gt;</code>?</p></li> </ol> <p>These are the problems that prevent me from using my C++ DLL inside my C# applications. I was told that I need to create a wrapper with C++/CLI and then use that inside my C#. But sadly I have no idea about it, I don't know C++.net.</p> <p>The only thing that currently seems to be a bit more sensational to me is to make it somehow compatible with C and then create a C DLL and use that in my C# application. I have read that in C, class object pointers are accessible through <code>HANDLE</code>s, so I thought that would be good idea to get things going without a lot of changes. </p> <p>So the question is how can I use Handles to access my class objects in C and use them? And how can I convert a <code>vector&lt;wstring&gt;</code> to its C counterpart? If I want to use CLI to create a wrapper (DLL?) for my C++ DLL, to be used in other dotnet apps what should I do?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload