My first translation that I am unsure about, the C code is:
Code: Select all
#define SIMCONNECT_STRING(name, size) char name[size]
#define SIMCONNECT_GUID GUID
#define SIMCONNECT_STRINGV(name) char name[1]
#define SIMCONNECT_DATAV(name, id, count) DWORD name
#define SIMCONNECT_FIXEDTYPE_DATAV(type, name, count, cliMarshalAs, cliType) type name[1]
Code: Select all
#Macro SIMCONNECT_STRING(name_s, size)
name_s As String * size
#EndMacro
#Define SIMCONNECT_GUID GUID
#Macro SIMCONNECT_STRINGV(name_s)
name_s As String * 1
#EndMacro
#Macro SIMCONNECT_DATAV(name_s, id, count)
As DWORD name_s
#EndMacro
#Macro SIMCONNECT_FIXEDTYPE_DATAV(type_t, name_s, count, cliMarshalAs, cliType)
name_s(1) As type_t
#EndMacro
Code: Select all
#pragma pack(push, 1)
SIMCONNECT_REFSTRUCT SIMCONNECT_RECV
{
DWORD dwSize; // record size
DWORD dwVersion; // interface version
DWORD dwID; // see SIMCONNECT_RECV_ID
};
Code: Select all
SIMCONNECT_REFSTRUCT SIMCONNECT_RECV Field = 1
dwSize As DWORD ' record size
dwVersion As DWORD ' interface version
dwID As DWORD ' see SIMCONNECT_RECV_ID
End Type
Question: Several C code has structures that look like this:
Code: Select all
SIMCONNECT_ENUM_FLAGS SIMCONNECT_VOR_FLAGS;
static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_NAV_SIGNAL = 0x00000001;
static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_LOCALIZER = 0x00000002;
static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_GLIDE_SLOPE = 0x00000004;
static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_DME = 0x00000008;
Code: Select all
#Define SIMCONNECT_ENUM_FLAGS DWORD
' SIMCONNECT_ENUM_FLAGS SIMCONNECT_VOR_FLAGS;
Type SIMCONNECT_VOR_FLAGS As SIMCONNECT_ENUM_FLAGS ' flags for SIMCONNECT_RECV_ID_VOR_LIST
Static AS Const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_NAV_SIGNAL = &h00000001 ' Has Nav signal
Static AS CONST DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_LOCALIZER = &h00000002 ' Has localizer
Static AS CONST DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_GLIDE_SLOPE = &h00000004 ' Has Nav signal
Static AS CONST DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_DME = &h00000008 ' Station has DME
Translation help:
Code: Select all
STATIC AS CONST DWORD SIMCONNECT_UNUSED = DWORD_MAX ' special value to indicate unused event, ID
' SIMCONNECTAPI SimConnect_AddToDataDefinition(HANDLE hSimConnect, SIMCONNECT_DATA_DEFINITION_ID DefineID, const char * DatumName, const char * UnitsName, SIMCONNECT_DATATYPE DatumType = SIMCONNECT_DATATYPE_FLOAT64, float fEpsilon = 0, DWORD DatumID = SIMCONNECT_UNUSED);
DECLARE FUNCTION SimConnect_AddToDataDefinition CDECL( _
BYVAL hSimConnect AS HANDLE, _
BYVAL DefineID AS SIMCONNECT_DATA_DEFINITION_ID, _
BYVAL DatumName AS CONST ZSTRING PTR, _
BYVAL UnitsName AS CONST ZSTRING PTR, _
BYVAL DatumType AS SIMCONNECT_DATATYPE = SIMCONNECT_DATATYPE_FLOAT64, _
BYVAL fEpsilon AS SINGLE = 0, _
BYVAL DatumID AS DWORD = SIMCONNECT_UNUSED) AS SIMCONNECTAPI
Code: Select all
error 272: Local symbols can't be referenced, at parameter 7 (DatumID) of SimConnect_AddToDataDefinition() in 'BYVAL DatumID AS DWORD = SIMCONNECT_UNUSED) AS SIMCONNECTAPI'
In C I have this definition:
Code: Select all
#if !defined(SIMCONNECTAPI)
#define SIMCONNECTAPI extern "C" HRESULT __stdcall
#endif
Code: Select all
#If NOT DEFINED(SIMCONNECTAPI)
#Define SIMCONNECTAPI HRESULT
#EndIf
Note that anything that says SIMCONNECT_...STRUCT has been defined as a type.
I know that this is a lot. I've spent quite a bit of time researching, and this is kind of where I am stuck.