C++ in sbox?

I know that maybe this is not necessary, but I decided to ask this, is anyone planning to support C++ in some form? I know that @ViTaLC0D3R is currently doing lua support, it would be interesting to learn about C++ support, maybe someone is planning to do this.

To my knowledge, no… But if ur issue is that you don’t know C#; Learning C# won’t be too hard with a foundation of C++ as they both derive from C.

So I’m not not the only working on Lua I know some is porting the Gmod lua over and the Wiremod rewritten team is as well. However I’m sure what ur asking is possible I’m not sure it would be worth the effort. First u either need a C++ complies ported to C# which is possible just a lot of work. I want u to know that if someone created this it would be fucking amazing but I just don’t see that happening. It sounds crazy so right up my alley.

I personally thing its better to just rewrite everything.


For addons - no.
But you can probably whitelist ImportDLL attribute and everything else what is needed for it to run methods from your compiled C++ DLL.

You are 100% correct

I’m impressed that people are trying to build on top with C++ and Lua but it’s actually more damaging then beneficial and honestly a poor investment of time. I’ll Explain

Its important to understand that


C# is based on C++ and contains features similar to those of Java, the cross over is simple


Lua was made to be a configuration language — A language to use as an alternative to CSV/XML/JSON files which could be embedded into C/C++. C# can handle this because it’s not 2005 anymore.


Just writing compilers to help port things over is such a big and useless task because not only is it very time consuming and difficult, But mainly because the logic behind it. You are simply stacking:

C++ - C#

  • C++
  • C++ Pre Processor
  • C++ Compiler
  • C# code
  • C# Compiler
  • Jit Compiler ( OS )
  • Process

Lua - C#

  • Lua
  • lua - Compiler
  • lua Compiled into c#
  • C#
  • C# Compiler
  • Jit Compile
  • Process

VS (Taking the time to convert to C# which is future proofing yourself)

  • C#
  • C# Compiler
  • Jit Compiler

And some people want this to happen as an addon in game so your ported shirt works? Forget it…
Even as just a tool to convert things over, the time dev time is stupidly hard and massive.

Not everything that can be done should be done you see, there’s better things to spend all that effort on. :cupcake:


I always find it crazy that people wanna bring Lua and many other of their favorite languages to s&box.

I mean, It doesn’t make sense to me when I think of the possibility that someone would put so much effort and time to add C++/Lua/C etc support - which usually means adding layers on top of what is already a layer (s&box C#) - and not use all this effort and time to maybe simply learn C# (which is absolutely much easier than adding proper support to other languages unofficially in first place lol)

Adding c++ support is more about going layer down, where people would have possibility to play with memory etc. Some will say that it would allow for better performance but in reality C#'s garbage collector is all we’ll need while working on game modes.


I totally understand that, but it doesn’t look like it would improve performance if you are building a C++ layer on top of C# layer
It could only be better performance wise if Garry team would support both languages, but even that would be debatable i guess

How goods the Garbage collector! I was relieved when I found out about this since I was coming from java/js/lua. :penguin: