The <<extern>> directive allows for reflecting pre-existing data types and functions.
For example the PersistStore library uses the following declarations to reflect LSS data types
$struct+ LssSettings <<extern>>
{
$int32 flushTimeMilliSec;
$float64 cleanerUtilisationPercent;
$bool enableFileBuffering;
$bool enableWriteThrough;
$int32 maxNumSegmentsInCache;
$int32 numSegmentsPerCheckPoint;
$int32 segmentSize;
$bool forceIncrementMSSN;
$bool validateSUTDuringCheckPoint;
};
$enum+ EOpenMode <<extern>>
{
OM_CREATE_NEW,
OM_CREATE_ALWAYS,
OM_OPEN_EXISTING,
OM_OPEN_EXISTING_READ_ONLY,
OM_OPEN_EXISTING_SHARED_READ,
OM_OPEN_ALWAYS,
OM_DELETE_EXISTING,
};
As another example the cxWorkingSetIpc has the following declarations to reflect datatypes and functions defined in the cxMessage library:
$struct+ MessageWriterSettings <<extern>>
{
$ssize_t lowerHysteresisSendSize;
$ssize_t upperHysteresisSendSize;
$ssize_t normalCommitBufferSize;
$ssize_t sendSizeUntilBackToNormalBufferSize;
$ssize_t maxSendSize;
};
$struct+ MessageReaderSettings <<extern>>
{
$ssize_t normalCommitBufferSize;
$ssize_t maxMsgSize;
$ssize_t maxRecvSize;
};
$struct+ TcpSettings <<extern>>
{
$ssize_t sendBufSize;
$ssize_t recBufSize;
$bool enableNagle;
$bool enableKeepAlive;
$int32 keepalivetime;
$int32 keepaliveinterval;
};
$struct+ TcpMsgSessionSettings <<extern>>
{
$TcpSettings tcpSettings;
$MessageReaderSettings msgReaderSettings;
$MessageWriterSettings msgWriterSettings;
};
$enum+ EProtocol <<extern>>
{
TCP_IPv4,
TCP_IPv6
};
$enum+ ESessionFailureType <<extern>>
{
Session,
SessionRead,
SessionWrite
};
$enum+ EEndPointFailureType <<extern>>
{
Open,
Close,
SetOption,
Bind,
Listen,
Accept,
Connect
};
$struct+ ITcpMsgEndPoint <<extern -dc -copy>> {};
$class+ IoContextPool {};
$class+ TcpMsgServer {};
$class+ TcpMsgClient {};
$function+ <<extern>> IoContextPool* CreateIoContextPool(int32 numThreads);
$function+ void CloseIoContextPool(IoContextPool* pool);
$function+ <<extern>> TcpMsgServer* CreateTcpMsgServer(
IoContextPool* pool,
EProtocol protocol,
int32 port,
bool reuse_addr,
ITcpMsgEndPoint& ep,
const TcpMsgSessionSettings& sessionSettings);
$function+ void CloseTcpMsgServer(TcpMsgServer* server);
$function+ <<extern>> TcpMsgClient* CreateTcpMsgClient(
IoContextPool* pool,
ConstStringZ host,
ConstStringZ service,
ITcpMsgEndPoint& ep,
const TcpMsgSessionSettings& sessionSettings);
$function+ void CloseTcpMsgClient(TcpMsgClient* client);