1.3.2 DRCF Version Compatibility

The DRFL headers require C++11 or later and cannot be compiled as C. To use DRFL from C, write a small C++ wrapper with extern "C" functions. The underscore-prefixed functions take a handle: the TCP functions use the handle from _CreateRobotControl (released with _DestroyRobotControl), and the RT functions use the handle from _create_robot_control_udp (released with _destroy_robot_control_udp). CDRFLEx creates both handles.

Some functions may have different interface usage depending on the controller version. Set DRCF_VERSION to 2 or 3 according to the controller version. DRCF_VERSION must have the same value in every source file that includes the DRFL header. Set it once for the whole project as a compiler definition (for example -DDRCF_VERSION=2 or target_compile_definitions(<target> PRIVATE DRCF_VERSION=2)) rather than with #define in individual files. If DRCF_VERSION is not defined, DRFLEx.h uses 3.

Example of including and initializing DRFLEx in C++
 1// DRCF_VERSION is set as a compiler definition, for example -DDRCF_VERSION=3
 2#include "../../include/DRFLEx.h"
 3#include "util.hpp"
 4
 5const std::string IP_ADDRESS = "192.168.137.100";
 6
 7using namespace DRAFramework;
 8CDRFLEx robot;
 9
10bool g_bHasControlAuthority = FALSE;
11bool g_TpInitailizingComplted = FALSE;
12bool control_authority_granted = FALSE;