DLL functions are written in C, so the arguments that you pass to these functions must have the appropriate C data types.
The following data types are supported:
-
- Use this data type for arguments or return values with the following data types:
- int
- INT
- long
- LONG
- DWORD
- BOOL
- WPARAM
- HWND
The
type
works for all DLL arguments that have a 4-byte value.
-
- Use this data type for arguments or return values with the C data types long and int64. The
type
works for all DLL arguments that have an 8-byte value.
-
- Use this data type for arguments or return values with the C data types short and WORD. The
type
works for all DLL arguments that have a 2-byte value.
-
- Use this data type for arguments or return values with the C data type bool.
- String
- Use this for arguments or return values that are Strings in C.
-
- Use this for arguments or return values with the C data type double.
-
- Use this for arguments with the C data type RECT.
cannot be used as a return value.
-
- Use this for arguments with the C data type POINT. Point cannot be used as a return value.
-
- Use this for arguments with the C data type HWND. TestObject cannot be used as a return value, however you can declare DLL
functions that return a HWND with an Integer as the return type.
Note: The passed TestObject must implement the
interface so that
Silk4NET is able to determine the window handle for the TestObject that should be passed into the DLL function. Otherwise an exception
is thrown when calling the DLL function.
- List
- Use this for arrays for user defined C structs. Lists cannot be used as a return value.
Note: When you use a List as an
parameter,
the list that is passed in must be large enough to hold the returned contents.
Note: A C struct can be represented by a List, where every list element corresponds to a struct member. The first struct member
is represented by the first element in the list, the second struct members is represented by the second element in the list,
and so on.
Note: Any argument that you pass to a DLL function must have one of the preceding
data types.