ā Is it efficient and worth doing?
[newb alert. Please explain everything so that newb a.k.a. me understand lol] Is it efficent I to write all the window and renderer code in C++/C, compile it into dll library and use dllimport/LibraryImport to import and use the methods? How would I make it so C# code interacts with the window generated/made by the C code?
10 Replies
Also If its not efficent is there more efficent way to do something like this? And yes I'm aware that things like Silk.NET exist but I wanna do it for fun
this is basically what Unity does I believe, so yes it's possible and i think the only way of interacting with a C/C++ library
for window interaction it's likely you could pass a handle to the C# side and do things with it there, but I don't know what you want to do specifically
But the main question is, is that the most efficent and easy way? Is there more efficent way of doing it which will not take too long?
pinvoke/dllimport would be the easiest & simplest way yes
I mean, sure, you can do it, but... why?
You might save a few CPU cycles here and there by using C++ or C instead of C#, but is it worth it?
Are you running into some actual bottlenecks?
but I wanna do it for funš¤·āāļø
For window interaction, C# doesn't add enough of a significant extra cost to warrant doing this. However, yes it is possible. If you're doing it for fun, go ahead, but the practicality of this is questionable, and I believe the technical debt to your app that you are introducing would be higher than the invisible gains you are receiving.
Or would it be better I to build all the graphic and rendering framework on C++ and use C# only for program logic and calls?
That's a reasonable choice imo
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.
Was this issue resolved? If so, run /close
- otherwise I will mark this as stale and this post will be archived until there is new activity.