What is a driven prototype?
I just need to clarify what a managed prototype is.
I think this is a method that uses the DLLImport attribute and has a way like this:
[DllImport("user32.dll")]
private static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);
Does this always mean that you have to have a DLLImport attribute and then a signiture method which is a private static extern ???
Greetings
source to share
A function prototype is a function that is declared purely as a way for the compiler to design a way to call some code without necessarily having that "some code" viewable, so without a prototype it will fly blindly related to the types of the arguments, etc.
So for the P / Invoke function, i.e. calling functions in native DLLs from a managed language like C #, yes, you need those prototypes if you can't find a pre-existing class in .NET that either wraps that function or a DLL, or implements similar functionality in pure managed code ...
And yes, you need an attribute [DllImport...]
to point to the DLL with the function, and it must be static and extern, but it doesn't need to be private, although this usually happens, usually because you end that function in a managed class makes it easier to use the rest of your code.
source to share