e5ddbd9886
On SDKs which use protobufs, the engine has objects compiled against a specific version of protobuf. Normally this is fine, we take care on Linux to use the same C++ ABI. On macOS however, we use libc++ to enable C++11 functionality, whereas the protobuf library has been compiled with libstc++. These ABIs are not compatible. To address the problem, we introduce PbHandle. PbHandle is a wrapper around protobuf::Message with two added pieces of state: whether or not the handle "owns" the message (and can free it in its destructor), and whether or not the handle was created by the engine (private) or created by SourceMod (local). Whenever we transfer a protobuf::Message pointer to SourceMod, we must take care to convert it to a Local version first. Whenever we transfer a protobuf pointer to the engine, we must convert it to a Private handle. For platforms with no ABI differences (almost all of them), the handle is a no-op. The private and local localities are compatible and no translation takes place. On macOS, CS:GO does require translation. SourceMod loads a tiny shim library that contains a copy of the protobuf sources compiled against the game's ABI. It then provides serialization and deserialization methods. SourceMod must not interact with the game's protobuf objects without first going through this proxy library. Note that PbHandle is not quite like unique_ptr. It can be converted into a PbHandle that does not destroy the underlying object. This is mainly because UserMessages.cpp has rather complex state, so it is useful to track locality without destroying an object. An unowned PbHandle must not outlive the owning PbHandle. |
||
---|---|---|
.github | ||
bridge/include | ||
configs | ||
core | ||
editor | ||
extensions | ||
gamedata | ||
licenses | ||
loader | ||
plugins | ||
public | ||
sourcepawn@71016c40cf | ||
tools | ||
translations | ||
versionlib | ||
.arcconfig | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
.travis.yml | ||
AMBuildScript | ||
changelog.txt | ||
configure.py | ||
product.version | ||
pushbuild.txt | ||
README.md |
SourceMod
General
- SourceMod website: Source Engine scripting and server administration
- Forum: Discussion forum including plugin/extension development
- General documentation: Miscellaneous information about SourceMod
- Stable builds: The latest stable SourceMod releases
- Dev builds: Builds of recent development versions
Development
- Issue tracker: Issues that require back and forth communication
- Building SourceMod: Instructions on how to build SourceMod itself using AMBuild
- SourcePawn scripting: SourcePawn examples and introduction to the language
- SourceMod plugin API: Online SourceMod plugin API reference generated from the include files
- SourceMod extension development: C++ examples and introduction to various extension interfaces
Contact
License
SourceMod is licensed under the GNU General Public License version 3. Special exceptions are outlined in the LICENSE.txt file inside of the licenses folder.