Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#Actualfrob

Posted 28 March 2013 - 01:14 PM

Well MonoGame uses OpenTK for the OpenGL/ES backends. I checked the source code and it uses System.Runtime.InteropServices not DllImport or any of the other P/Invoke methods (although I don't know what InteropServices does in the backend).

 

I think you misunderstand what p/invoke means.

 

p/invoke is a shorthand for saying it uses InteropServices to perform automatic marshalling to and from the platform's libraries rather than using the .net method.

 

The source code you linked to has about 600 lines of this:

[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawArrays", ExactSpelling = true)]
internal extern static void DrawArrays(OpenTK.Graphics.ES20.BeginMode mode, Int32 first, Int32 count);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawElements", ExactSpelling = true)]
internal extern static void DrawElements(OpenTK.Graphics.ES20.BeginMode mode, Int32 count, OpenTK.Graphics.ES20.DrawElementsType type, IntPtr indices);

 

 

That is a textbook example of p/invoke.  

 

You wrote it does not use DllImport, but every single one of those entries is marked as DllImport.  Every single function is marked with "System.Runtime.InteropServices.DllImport".

 

 

That is what Serapth was pointing out.  It uses p/invoke all over the place, which your source code link confirmed rather than denied.

 

 

This is one reason I personally dislike the "free" libraries that have requirements of paid libraries.  They are generally less free than they advertise.


#1frob

Posted 28 March 2013 - 01:10 PM

Well MonoGame uses OpenTK for the OpenGL/ES backends. I checked the source code and it uses System.Runtime.InteropServices not DllImport or any of the other P/Invoke methods (although I don't know what InteropServices does in the backend).

 

I think you misunderstand what p/invoke means.

 

p/invoke is a shorthand for saying it uses InteropServices to perform automatic marshalling to and from the platform's libraries rather than using the .net method.

 

The source code you linked to has about 600 lines of this:

[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawArrays", ExactSpelling = true)]
internal extern static void DrawArrays(OpenTK.Graphics.ES20.BeginMode mode, Int32 first, Int32 count);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawElements", ExactSpelling = true)]
internal extern static void DrawElements(OpenTK.Graphics.ES20.BeginMode mode, Int32 count, OpenTK.Graphics.ES20.DrawElementsType type, IntPtr indices);

 

 

That is a textbook example of p/invoke.  

 

You wrote it does not use DllImport, but every single one of those entries is marked as DllImport.  But if you look it over, every single function is marked with "System.Runtime.InteropServices.DllImport".

 

 

That is what Serapth was pointing out.  It uses p/invoke all over the place, which your source code link confirmed rather than denied.


PARTNERS