Fix MarshallAs issue with raylib structs
See original GitHub issueThere are issues getting unmanaged arrays with a fixed size to work in C#. I have had errors with using LoadShader throwing error “Method’s type signature is not PInvoke compatible”.
I am not sure what I am doing wrong. Here are the structs using MarshallAs currently and the array from C.
- Mesh
unsigned int vboId[7];
- Shader
int locs[MAX_SHADER_LOCATIONS];
- Material
MaterialMap maps[MAX_MATERIAL_MAPS];
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Marshalling C struct with fixed size array into C# - ...
Im trying to Marshall a C struct into C# like so [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct Shader { public ...
Read more >Help with structs? : r/raylib
I'm trying to wrap rayLib for OpenXTalk. The help I have said: struct Color; [ 4 bytes] - // RGBA values, 4 char,...
Read more >js game engine - OSCHINA - 中文开源技术交流社区
sge2d, SDL Game Engine 是一个平台无关的 2D 游戏C++编程框架。 2011-02-27 06:43:19. 3k.
Read more >Ray
Hey! Just released a new side project: #raylib parser! A small C program to parse raylib.h and extract structs/enums/functions data.
Read more >How to create a club on zwift
Keep reading to see how it works! Create Your Own Meetup Event. STCC has set up a club account to use for Zwift...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update, after looking at the different options it seems you cannot Marshall fixed size arrays without using the fixed keyword. This requires this library and any that use it to be compiled as unsafe. For now it will use this instead.
I will keep this issue open for now in case a better solution is found in the future.
At the moment it is compiled as unsafe. I may keep it like that. I have tested using Span properties that use the IntPtr for mesh vertices, texcoords etc. Not sure if I prefer that.