porting native c++ code to use with .NET

C

csharpdevp

I am going to repost a question I asked earlier as it is turning out to
be quite a bit more complicated than I anticipated it to be. I have a
bunch of projects written in native C++ (made using VS6 perhaps). Since
I have not developed this code, I don't have the ground knowledge of
how it works. All I know is that somehow they are being wrapped and
used in other applications.

In fact, the application I am currently working on needs these projects
as well. Although, the application itself has been developed in C# and
is working perfectly, my project team has decided that it would be
better if we have the source code for the C++ modules in the
application solution directly, so that we may be able to debug it in
future. Right now we just reference to a bunch of wrapped dlls, which
use Pinvoke somehow to work with the native C++ code.

Now, this issue of porting the code is increasingly looking very messy.
I just checked the documentation made by the developer who wrapped the
native dlls. The cygwin shell is used to generate wrapped c# code -
basically a lot of .cs files. The method entailed to do this seems more
complicated, as it is also using the SWIG software; how? I have yet to
figure out the nitty-gritty of it. I don't have access to the .cs
files, but there is a VS solution file, which on loading gives a long
list of .cs files which are not actually present. Apparently, this has
been done intentionally, as the original developers did not want anyone
to play around with the wrapped c charp code generated, and only wanted
the solution to generate the required dlls. And this is the part where
my head starts to spin completely.

We have the .cpp and .h files for the concerned projects. Is there a
reasonably straightforward way to incorporate them into VS8 without
having to do any of this complicated dll wrapping, and just to compile
the C++ code directly? Considering it is native code, will I have to
study the code and change around a lot of things. While I'm working on
it, I'm also not sure if it is feasible and would not like to spend
time working in the wrong direction. I imagine if the c++ code can be
incorporated in VS8 and compiled, using it with the concernde C# files
should not be that big a problem. But I'm quite unsure how I can
achieve that or if it's even possible.

I welcome any kind of suggestion and advice regarding this issue.

Thanks!
 
L

Lloyd Dupont

1st you should try to make this VC8 project with just the .cpp & .h.
Perhaps it will just compile (after some amount of work....)

If it does, well SWIG is a tool to generate interface and doesn't work well
with VS. so you should keep swig to generate the C# file.
but nothing prevent you from compiling these C# files with VS as well!


And last but not least you could write some hand made managed ++ wrapper if
you like things to be clear.

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.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