-
In my long journey into proper P/Invoke on WASM support in Silk.NET, ive gotten the code compiling and launched, with the generator using P/Invoke internally, specifically [System.Runtime.InteropServices.DllImport("SDL", EntryPoint = "SDL_Init", CallingConvention = (System.Runtime.InteropServices.CallingConvention)2)]
private static extern int I_SDL_Init(uint p0); in this case But upon attempting to call said function (more specifically a public wrapper over said function) i get a Test project that calls it: https://github.com/Beyley/UnoPInvoke Heres the full generated code The public wrapper of said function is created by getting a function pointer to the external function public partial int Init(uint flags)
{
unsafe
{
int n1;
SilkMarshal.Log(); // BEGIN RESOLVE 1 | READCOUNT: 1 | ALLOW_INLINE: False | FORCE_INLINE: False | CACHED: False
// BEGIN RESOLVE 0 | READCOUNT: 1 | ALLOW_INLINE: True | FORCE_INLINE: False | CACHED: False
// RESOLVED 0 INLINED
// END RESOLVE 0
// RESOLVED 1 TO VARIABLE n1
n1 = ((delegate* unmanaged[Cdecl]<uint, int> )(CurrentVTable as GeneratedVTable).SDL_Init)((/* VAR 0 */
flags)); // END RESOLVE 1
// ALREADY RESOLVED 1
return /* VAR 1 */
n1;
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Seems to be caused by not haivng a UnmangedCallersOnly attribute (which is not on netstandard 2.0), so this may just not work on net standard 2.0 |
Beta Was this translation helpful? Give feedback.
Seems to be caused by not haivng a UnmangedCallersOnly attribute (which is not on netstandard 2.0), so this may just not work on net standard 2.0