Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

D8045: cannot compile C file 'serialcommands.c' with the /clr option

Tags:

.net

clr

c++-cli

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?

like image 401
MedicineMan Avatar asked May 19 '09 00:05

MedicineMan


1 Answers

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.

like image 95
Reed Copsey Avatar answered Oct 26 '22 13:10

Reed Copsey