I know that you can compile my C code in a dll and then use P / Invoke to call that code.
What I was wondering is is it possible to have a piece of C code embedded directly in my code, possibly only available for one class ...
Something like this (non-working) example:
public class MyClass { extern "C" { int do_something_in_c(int i) { return i*2; } } public int DoSomething(int value) { return do_something_in_c(value); } }
I have been trying for several hours to use Visual Studio 2008, but I will not go anywhere, and I suspect that this is actually not possible. Can anyone confirm or deny this?
Thanks.
c c # visual-studio-2008 embed
Jonathan
source share