It sounds like you are using PInvoke to call a function, but you have not declared it correctly. The signatures do not match. For example, if you were trying to call a function

Code:
void Foo(int* i)
but you declared it as

Code:
private static extern void Foo(byte* i);
that would cause an error, because you have declared the function incorrectly.