compiling unmanaged code in visual studio

  • Thread starter Thread starter csharpdevp
  • Start date Start date
C

csharpdevp

Hi

My application has been coded in C#, and it is being developed on
Visual Studio 8.0. There are some projects in my application that
needed C++ modules already built by another program. Since a
considerable amount of time and energy has been invested in writing
these C++ modules, my project team has decided not to rewrite this code
in C# and repeat the whole exercise.

Instead, these code modules were wrapped using SWIG, and used as
referenced Dlls from the C# projects. Everything works; however, we
have now recognised the advantages of having access to the source code
in the application solution. We want to be able to debug the source
code directly, if at all there is a need for it in future.

Either we re-write the code in C#, which has been ruled out completely.
The other thing would be to somehow have studio compile the unmanaged
code as managed code. I don't even know if this is possible. And since
I know very little about this subject as of now, I don't have much
perception about a potential solution. So while I research this, if any
of you have some sort of advice that could be helpful, I would
appreciate if you could share that with me.

Thanks!
 
Yes, you can use your current C++ code and compile it as Managed C++ using
the /clr option.

Actually, you'd probably be better off creating a new C++ project (.net type)
in VS8, and adding your source files to that project. This will ensure your
compilation options are ideal for generating .net assemblies.
 
Hi, using the '/clr' option gives the following error:

"Command line error D8016 : '/EHs' and '/clr' command-line options are
incompatible"

I created a new solution in VS8, and started an empty Visual C++
project. Then I added all the header and source files to the project.
Like you suggested, I added the '/clr' string to
Properties\Configuration Properties\C/C++\Command Line\Additional
options:.

Any idea what's going on?
 
Hi, using the '/clr' option gives the following error:

"Command line error D8016 : '/EHs' and '/clr' command-line options are
incompatible"

I created a new solution in VS8, and started an empty Visual C++
project. Then I added all the header and source files to the project.
Like you suggested, I added the '/clr' string to
Properties\Configuration Properties\C/C++\Command Line\Additional
options:.

Any idea what's going on?
 
Hi, using the '/clr' option gives the following error:

"Command line error D8016 : '/EHs' and '/clr' command-line options are
incompatible"

Use /EHa so that you get support for both C++ and SEH exceptions
I created a new solution in VS8, and started an empty Visual C++
project. Then I added all the header and source files to the project.
Like you suggested, I added the '/clr' string to
Properties\Configuration Properties\C/C++\Command Line\Additional
options:.

Any idea what's going on?

/EHs enables just unmanaged C++ exceptions, you must enable SEH
exceptions too.

Richard
 
Back
Top