cvelmessage.dll
cvelmessage.dll is a companian library to the CVE-lite programming library that is used by all vessels compiled against it, but is also available for third party vessels to use as a method communicating between specific objects in Orbiter.
Architecture
The DLL is not linked to the Orbiter API and can therefore interface objects that cannot directly communicate with C++-style calls for reasons of incompabile common library, or simple lack of inter-process communications channels (for example, MFD->vessel).
The method is to hold a table of messages and its category, their target and the time they were entered. The table dimensions are finite and if overfilled messages will be lost, but the library will remain light in memory.
The library is polled occasionally by the recipient proceses, passing its unique identifying pointer (normally their address in memory). If any messages are in the table, the eldest is returned to the calling process, and deleted from the list. The next will be returned on the on the subsequent call.
At every poll, or message log, the table is scanned for old (undelivered) messages. If any are found they are deleted, and their space made available for new messages.
This design allows a process to safely send a message to any other process, whether it supports it or not. If it doesn't, it doens't get delivered and will be deleted. A C++-style linking would cause an exception, were the target to be unreceptive.
Method of implementation
The normal method of implementation in Orbiter is for a recepient to poll during the timeloop with a loop similar to:
if( CheckCentralMessage() ) // at least one message pending, we need to refresh while( CheckCentralMessage() ) // loop through any remaining ReactToMessages();
To send a message:
SendCentralMessage( (VESSEL*)companion_vessel, "COMMAND", "OPEN FIRE" );
Examples of use
Flight Instrumentation MFD communicating with Aircraft.dll.