idlproc language [options] [--] infile [outfile]
language
specifies the consumer to use and must be given as first argument. Supported: Pascal
.
infile
is the first input file.
outfile
may be given as a file or directory name. If not given, the current directory is assumed. Giving a file name is only valid if -D
was not used.
-D --dependencies
Follow dependencies via#include
directives
IDL2pas uses a restricted version of MIDL with some features added from XPIDL.
The following data types are considered "predefined" and guaranteed to have representations in all consumers. Const-, Reference- or Pointer-ness that is caused by direction modifiers (see Methods below) are not part of the type itself, but instead are generated by the consumer. Interface types are always considered to be passed as instance pointers. Note that this is in contrast to MIDL.
Type Name(s) | C++ Equivalent | ObjFPC Equivalent |
---|---|---|
Boolean |
bool |
Boolean |
UInt8 |
unsigned char |
Byte |
UInt16 |
unsigned short |
Word |
UInt32 |
unsigned long |
DWORD |
UInt64 |
unsigned long long |
QWORD |
Int8 |
char |
Smallint |
Int16 |
short |
Shortint |
Int32 |
long |
Integer |
Int64 |
long long |
Int64 |
Pointer |
void * |
Pointer |
PtrInt |
size_t |
PtrInt |
PtrUInt |
usize_t |
PtrUInt |
CString |
char * (default system codepage) |
PAnsiChar |
CUTF8String |
char * (encoded as UTF8) |
PUtf8Char |
CWString |
wchar_t * (arbitrary encoding) |
PUnicodeChar |
IID |
REFIID |
TGUID |
-
#include "file.idl"
Read data fromfile.idl
next, return to next line in current file afterwards. Relative paths to the current file are allowed. May occur anywhere a token would be allowed, but must end on a line end. -
Language-specific extensions:
%{[lang] (language-specific code here) %}
Emit code verbatim. Optionally give lang on first line to only emit for a specific language consumer. May only occur as top-level declaration.
Declarations may optioanlly be wrapped in a MSIDL-Typelib-library
definition, but this is not required.
Many Declarations accept Attributes specified before them, they are not spelled in syntax examples here for brevity. Relevant Attributes are given in the Declaration descriptions below.
-
Interface
interface Name { [Declarations] };
Attributes:
forward
: Marks forward declaration, full declaration follows later.uuid(IID)
: Interface GUID, required unlessforward
is set. Contents:Method
Property
-
Module
module Name { [Declarations] };
Attributes:
dllname("filename.dll")
: DLL (or SO) to import functions from Contents:Constant
Method
(will be translated as static imports)
-
Alias
typedef TypeSpec Name; /* See "Array types" below */
Attributes:
-
Enum
typedef enum { EnumItem, EnumItem = Number } Name;
Attributes:
enumsize(number)
: byte size of the enum, used to enforce packing
-
Struct
typedef struct { TypeSpec Name; /* See "Array types" below */ } Name;
Attributes: Contents:
Field
, see above
-
Method
TypeSpec Name ( [ Parameter [, Parameter] ]); Parameter: [Attribute] [in|out|inout] TypeSpec Name /* See "Array types" below */
Attributes for Parameters:
const
: compiler hint that the parameter will not be modified. Note that this is different from theconst
that may be part of the TypeSpec proper.
Parameters are by default passed by value. The
[const]
attribute does not change that, it only allows optimized checking for the consuming compiler. The direction modifiers allow changing this:without [const]
with [const]
nothing COM standard const in
COM standard constref out
by reference, input value is never used (invalid) inout
by reference (invalid) -
Property
[readonly] attribute TypeSpec Name;
Implies 2 Methods:
TypeSpec GetName()
andSetName(TypeSpec newval)
(in order). Setter is only generated ifreadonly
prefix is not given. -
Array Types
TypeSpec Name; /* No Array */ TypeSpec Name[5]; /* Array with 5 elements, index 0..4 */ TypeSpec Name[]; /* Dynamic Array (definition as pointer type is preferred for portability) */ TypeSpec Name[5][4]; /* array[0..4] of array[0..3] of TypeSpec */
-
Callback
typedef callback TypeSpec Name ( [ Parameter [, Parameter] ]);
Function pointer commonly used for callbacks. Identical to Method decalaration, see above for full description. Note that in constrast to C(++), the pointer is implied and not attached to
Name
. -
Const
const TypeSpec Name = Value;
Attributes for Parameters:
static_cast
: Hint that the literalValue
is not directly compatible toTypeSpec
and may need an explicite type cast.