I'm just trying to figure out how to call C code from C#.
I have the following C code:
#include <stdio.h>
extern void print(const char *message)
{
printf("%s\\n", message);
}
I compile this with:
cl /LD printf.c
That produces a dll. But
dumpbin /exports printf.dll
shows no entry point:
Microsoft (R) COFF/PE Dumper Version 14.00.23918.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file printf.dll
File Type: DLL
Summary
2000 .data
1000 .gfids
7000 .rdata
1000 .reloc
10000 .text
And trying to call it from C# turns up an EntryPointNotFoundException (I import it like this:)
[DllImport("printf.dll", EntryPoint = "print")]
static extern void print(string message);
So what am I missing here?