views:

1204

answers:

1

I am getting compiler error D8045. cannot compile C file 'serialcommands.c' with the /clr option.

This file is a C library that has been written to talk over a serial port to a TI processor. The task that I need to do is wrap this library with a CLR wrapper (there will be additional questions posted to stackoverflow concerning marshalling data back and forth if you want some more easy points from CLI questions.)

I just want to use this C library from my CLR wrapper. I went to Properties->Configuration Properties->C/C++->General->Compile with Common Language runtime support = No Common Language Runtime support

Is this the correct way to do this? Will I experience nasty weird bugs later or are other things that I need to do to use this?

+1  A: 

Yes. You need to compile any C objects without /CLR, since the clr only understands classes and objects.

You can still use them from your C++/CLI project, wrapped inside of your "ref class" objects. This is a normal way of wrapping a C api in .NET objects.

Reed Copsey