Reputation: 510
We have an application that runs on an embedded target using a LEON2 processor which is written in ANSI C. We seem to have an issue with the code calculating the checksum and I'd like to simply copy that function into a C# application to test it.
I'd really like to be able to do something in those lines so I could really have the same code that is on the embedded target rather than rewriting it and potentially adding errors or doing it differently.
Is this possible?
Upvotes: 1
Views: 722
Reputation: 9916
I'd like to simply copy that function into a C# application to test it.
Unfortunately, you can't. C# is a managed language, unlike native C. C# is therefore not backward-compatible with C/C++, and you cannot mix unmanaged code in your C# application.
I'd really like to be able to ... have the same code that is on the embedded target rather than rewriting it ...
Create a separate DLL that exports the necessary function(s) and call them from there.
Upvotes: 2