Using C++ dll in C#

Aug 20, 2010 at 11:57pm
Hi.
I wrote a dll in C++ and I want to use it in C#.
I have some questions:

1. Can I declare a global array in dll? if yes, it's syntax should be C++-like or C#-like?
2. How can I pass an array to dll as a function parameter or recieve an array as function return?
3. Can a function in dll call other functions within same dll? if yes, should other functions have __declspec(dllexport) in prototype?

Thanks :)
Aug 21, 2010 at 12:18am
I know this probably won't do you much good now but it's generally easier to interface C++ code with C# code if the C++ is written with .NET not standard C++.
Aug 21, 2010 at 9:44am
I don't understand what you say.
Please answer clearly.
Thanks
Aug 21, 2010 at 10:54pm
All the .NET languages (such as C#) are designed so that they can be used in combination (for example C++.NET and C#). Normal C++ however was not designed the same so if you wrote your dll in anything but .NET it could be tricky to link the to bits of code together.
Aug 22, 2010 at 4:01pm
Dudester meant that if you use VisualStudio and use C++ .NET to create the DLL, all you have to do is include this DLL in the reference of your C# project.
Topic archived. No new replies allowed.