I have a trouble invoking C function from my C# code. I wanted to add some functionality to VLC player(we use it in our software through vlcdotnet) and cross-compiled it on my ubuntu 12.10 for windows using mingw. I wrote a function, let's call it Foo:
__declspec(dllexport) void Foo(vlc_object_t* bar);
Now I want to call it from C#:
[LibVlcFunction("Foo")]
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void Foo(IntPtr pointer);
........
public LibVlcFunction<Foo> Foo { get; private set; }
......
Foo = new LibVlcFunction<Foo>(myLibVlcCoreDllHandle, VlcVersion);
And it fails. Inside constructor of LibVlcFunction we have combination of GetProcAddress and GetDelegateForFunctionPointer. GetProcAddress fails with "The address of function 'Foo' doesn't exists...." but dumpbin and dep. walker are saying that function exists and her name is not mangled. I tried to write a C++ app that loads a libvlc.dll and gets pointer to my func and it worked. But in C# it fails. What should I do? Any suggestions?