What's an ABI compatibility layer and why could we need it?
Currently, the compiler used to compile Spring core dictates the possible compiler to use to compile global AIs.
The ABI compatibility layer aims to allow us to use any compiler to compile global AIs, regardless of the compiler used to compile spring.
Status
Feature complete with the AI .Net interface, except for GiveGroupOrder, AddMapPoint, GetMapPoints.
How does it work?
The ABI compatibility layer converts the C++ GlobalAI interface presented by Spring to a C-interface. C-interface ABIs are standard across different compilers, a few underscores notwithstanding.
What's an ABI?
ABI is "Application Binary Interface". It's what gets exposed by dlls and sos, and is used to link the dll with another application at runtime. There are two parts to an ABI:
*name mangling. This means: how do we convert the name of a function, possibly in a class, to some globally unique string
*argument marshalling. How do arguments get passed to and from the function across the link boundary
C-interface argument marshalling is standardized across compilers. At least, each compiler is capable of certain calling conventions, such as extern "C", and there are calling conventions which are portable across multiple compilers.
C-interface name mangling is almost standard. Some compilers add an underscore at the start, some dont; its possible to use dlltool or similar to tweak this.
C++ ABIs are not standard across compilers, neither for name mangling nor for argument marshalling. C++ ABIs arent guaranteed to be standard across different versions of the same compiler.
Download
ABIC is now integrated into Spring SVN, in the directory rts/ExternalAI/GlobalAICInterface. See AI/Global/TestABICAI for an example of using ABIC directly.
Abic++ C++ wrappers are available within AI/Global/CSAI/AbicWrappers directory n Spring SVN. Just add the following includes to your program:
Code: Select all
#include "AbicAICallbackWrapper.h"
#include "AbicFeatureDefWrapper.h"
#include "AbicMoveDataWrapper.h"
#include "AbicUnitDefWrapper.h"