Logo
Talk is cheap. Show me the code.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Azure Azure
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • All Categories
As an Amazon Associate ProgrammerHumor.io earns from qualifying purchases.

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Extern c Memes

Posts tagged with Extern c

Hand-Written Mangled Symbols Save The Day

C++ Gamedev
6 hours ago 15.5K views 0 shares
Hand-Written Mangled Symbols Save The Day
The EA memory card library was compiled with a different C++ ABI than the game, so the linker couldn't find the symbols it needed. The fix was to skip the compiler's name mangling and type every mangled name by hand. Each one is declared inside an extern "C" block. Each also gets a wrapper that takes void* for everything and forwards to the real symbol. Look at the names. Save__Q211RealmcIface16MemcardInterfacePCcN21PCQ211RealmcIface8SaveInfo... is a C++ method that the compiler encoded as a string. The encoding holds the namespace, class, argument types, const-ness and pointer depth. Somebody had to get it character-perfect, and one wrong letter means a linker error. The void* parameters mean they gave up on types entirely. The linker only matches names, so the types didn't matter. It's ugly, and it shipped on a game that sold millions. That's a decent argument that "ugly but working" beats "elegant but late" in game dev. Somewhere a dev typed PCQ211RealmcIface9TitleInfo a few times and decided it was a problem for future them.

Today's picks

Poor Jensen

Poor Jensen

Hardware
131.1M views 23 days ago
Dual Monitor Stand - Vertical Stack Screen Free-Standing Monitor Riser Fits Two 13 to 34 Inch Screen with Swivel, Tilt, Height Adjustable, Holds One (1) Screen Up to 44Lbs

Dual Monitor Stand - Vertical Stack Screen Free-Standing Monitor Riser Fits Two 13 to 34 Inch Screen with Swivel, Tilt, Height Adjustable, Holds One (1) Screen Up to 44Lbs

Affiliate
$29.99
Gotta keep it real

Gotta keep it real

Debugging
100.6K views 4 years ago