Judging by a quick experiment 'loadlib' is not recognised as a Lua command by GG, in fact notepad++ doesn't even recognise it as a command!
Aha, this is a Lua 5.0 command, we are on 5.2 and this has been moved to the package library, so package.loadlib() is recognised.
Although I'm having a hard time seeing what you would use this for, a library written in C++ may execute slightly faster than a raw Lua function but not enough to make the extra complexity worthwhile.
If there were a C++ API for GG giving dynamic access to internal data structures then it might be more useful, but there isn't, all acees would have to go via Lua so you would have the added overhead of conversion of data to/from Lua in your library which you wouldn't have if you simply write the equivelent functions in Lua directly, i.e. simply write Lua libraries and load them in at runtime.
Been there, done that, got all the T-Shirts!