H
Henrik
I have been googling for hours now without being able to find just _one_
example / guide on how to call a C-function from C# Not a C++
function,...but a C-function!!
I have tried to create a solution in VS 2010 and add two projects to that
solution.
One project is a C-project that only contains one file myfile.c
The contents of myfile.c looks like this:
int addTwo(int x, int y)
{
return (x + y)
}
The other project is a C# project with a file called program.cs
In that file I have written:
[DllImport("mydll.dll", EntryPoint= "addTwo")]
static extern int addTwo(int x, int y);
static void Main(string[] args)
{
Console.Writeline(addTwo(5,2).ToString());
}
I get a System.EntryPointNotFoundException.
Unable to find entry point named 'addTwo' in DLL 'mydll.dll'
What am I doing wrong here???
example / guide on how to call a C-function from C# Not a C++
function,...but a C-function!!
I have tried to create a solution in VS 2010 and add two projects to that
solution.
One project is a C-project that only contains one file myfile.c
The contents of myfile.c looks like this:
int addTwo(int x, int y)
{
return (x + y)
}
The other project is a C# project with a file called program.cs
In that file I have written:
[DllImport("mydll.dll", EntryPoint= "addTwo")]
static extern int addTwo(int x, int y);
static void Main(string[] args)
{
Console.Writeline(addTwo(5,2).ToString());
}
I get a System.EntryPointNotFoundException.
Unable to find entry point named 'addTwo' in DLL 'mydll.dll'
What am I doing wrong here???