Is it possible to use cpp/c++ for FiveM resource development?

My question is pretty simple -
Would it be possible to use C++ for resource development within the server and client environment? I know you can use C#.

I googled and asked chatGPT. On google I found nothing, but chatGPT told me, it might be possible by compiling my C++ code to a DLL and then running it from a C# DLL. However, I’m not sure.

The reason might seem a little strange, and it is. It’s mainly because I’m learning C++ and want to move on from Lua and C#, but at the same time, I want to keep developing resources.

Thanks for your time!

unhealthy… But for the current time its is possible however performance wise i would not suggest it.

Could you explain why? I know C# has its performance issues atm, but C++ goes without a garbage collector, so I can’t see how that would impact performance.

Also, do you know how it could be possible?

I Believe it is due to runtime, i personally haven’t had personal use reason with it within Fivem due to that.

1 Like

That makes sense. Thanks for the quick responses, I guess I’ll just have to stick with Lua for now.

There’s no way to directly write scripts in C++, the only way currently is to use the JavaScript runtime with WASM. You can use Emscripten to compile your C++ code to WASM and run it, but you will have write wrappers for using natives, events & coroutines.

1 Like

Thanks for the answer! Besides the annoying work of manually writing wrappers for natives, etc. would this have a huge cost on the performance benefits C++ originally provides?

There’s probably some overhead with calling JavaScript from WASM, which you’d be doing for every native call.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.