You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-34Lines changed: 63 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,41 +149,43 @@ Usage:
149
149
ClangSharpPInvokeGenerator [options]
150
150
151
151
Options:
152
-
-a, --additional <additional> An argument to pass to Clang when parsing the input files. []
153
-
-c, --config <config> A configuration option that controls how the bindings are generated. Specify 'help' to see the available options. []
154
-
-D, --define-macro <define-macro> Define <macro> to <value> (or 1 if <value> omitted). []
155
-
-e, --exclude <exclude> A declaration name to exclude from binding generation. []
156
-
-f, --file <file> A file to parse and generate bindings for. []
157
-
-F, --file-directory <file-directory> The base path for files to parse. []
158
-
-h, --headerFile <headerFile> A file which contains the header to prefix every generated file with. []
159
-
-i, --include <include> A declaration name to include in binding generation. []
160
-
-I, --include-directory <include-directory> Add directory to include search path. []
161
-
-x, --language <language> Treat subsequent input files as having type <language>. [default: c++]
162
-
-l, --libraryPath <libraryPath> The string to use in the DllImport attribute used when generating bindings. []
163
-
-m, --methodClassName <methodClassName> The name of the static class that will contain the generated method bindings. [default: Methods]
164
-
-n, --namespace <namespace> The namespace in which to place the generated bindings. []
165
-
-om, --output-mode <CSharp|Xml> The mode describing how the information collected from the headers are presented in the resultant bindings. [default: CSharp]
166
-
-o, --output <output> The output location to write the generated bindings to. []
167
-
-p, --prefixStrip <prefixStrip> The prefix to strip from the generated method bindings. []
168
-
-r, --remap <remap> A declaration name to be remapped to another name during binding generation. []
169
-
-std <std> Language standard to compile for. []
170
-
-to, --test-output <test-output> The output location to write the generated tests to. []
171
-
-t, --traverse <traverse> A file name included either directly or indirectly by -f that should be traversed during binding generation. []
172
-
-v, --version <version> Prints the current version information for the tool and its native dependencies.
173
-
-was, --with-access-specifier <with-access-specifier> An access specifier to be used with the given qualified or remapped declaration name during binding generation. Supports wildcards. []
174
-
-wa, --with-attribute <with-attribute> An attribute to be added to the given remapped declaration name during binding generation. Supports wildcards. []
175
-
-wcc, --with-callconv <with-callconv> A calling convention to be used for the given declaration during binding generation. Supports wildcards. []
176
-
-wc, --with-class <with-class> A class to be used for the given remapped constant or function declaration name during binding generation. Supports wildcards. []
177
-
-wg, --with-guid <with-guid> A GUID to be used for the given declaration during binding generation. Supports wildcards. []
178
-
-wlb, --with-librarypath <with-librarypath> A library path to be used for the given declaration during binding generation. Supports wildcards. []
179
-
-wmi, --with-manual-import <with-manual-import> A remapped function name to be treated as a manual import during binding generation. Supports wildcards. []
180
-
-wn, --with-namespace <with-namespace> A namespace to be used for the given remapped declaration name during binding generation. Supports wildcards. []
181
-
-wsle, --with-setlasterror <with-setlasterror> Add the SetLastError=true modifier to a given DllImport or UnmanagedFunctionPointer. Supports wildcards. []
152
+
-a, --additional <additional> An argument to pass to Clang when parsing the input files. []
153
+
-c, --config <config> A configuration option that controls how the bindings are generated. Specify 'help' to see the available options. []
154
+
-D, --define-macro <define-macro> Define <macro> to <value> (or 1 if <value> omitted). []
155
+
-e, --exclude <exclude> A declaration name to exclude from binding generation. []
156
+
-f, --file <file> A file to parse and generate bindings for. []
157
+
-F, --file-directory <file-directory> The base path for files to parse. []
158
+
-h, --headerFile <headerFile> A file which contains the header to prefix every generated file with. []
159
+
-i, --include <include> A declaration name to include in binding generation. []
160
+
-I, --include-directory <include-directory> Add directory to include search path. []
161
+
-x, --language <language> Treat subsequent input files as having type <language>. [default: c++]
162
+
-l, --libraryPath <libraryPath> The string to use in the DllImport attribute used when generating bindings. []
163
+
-m, --methodClassName <methodClassName> The name of the static class that will contain the generated method bindings. [default: Methods]
164
+
-n, --namespace <namespace> The namespace in which to place the generated bindings. []
165
+
--nativeTypeNamesToStrip The contents to strip from the generated NativeTypeName attributes.
166
+
-om, --output-mode <CSharp|Xml> The mode describing how the information collected from the headers are presented in the resultant bindings. [default: CSharp]
167
+
-o, --output <output> The output location to write the generated bindings to. []
168
+
-p, --prefixStrip <prefixStrip> The prefix to strip from the generated method bindings. []
169
+
-r, --remap <remap> A declaration name to be remapped to another name during binding generation. []
170
+
-std, --std <std> Language standard to compile for. []
171
+
-to, --test-output <test-output> The output location to write the generated tests to. []
172
+
-t, --traverse <traverse> A file name included either directly or indirectly by -f that should be traversed during binding generation. []
173
+
-v, --version <version> Prints the current version information for the tool and its native dependencies.
174
+
-was, --with-access-specifier <with-access-specifier> An access specifier to be used with the given qualified or remapped declaration name during binding generation. Supports wildcards. []
175
+
-wa, --with-attribute <with-attribute> An attribute to be added to the given remapped declaration name during binding generation. Supports wildcards. []
176
+
-wcc, --with-callconv <with-callconv> A calling convention to be used for the given declaration during binding generation. Supports wildcards. []
177
+
-wc, --with-class <with-class> A class to be used for the given remapped constant or function declaration name during binding generation. Supports wildcards. []
178
+
-wg, --with-guid <with-guid> A GUID to be used for the given declaration during binding generation. Supports wildcards. []
179
+
-wlb, --with-librarypath <with-librarypath> A library path to be used for the given declaration during binding generation. Supports wildcards. []
180
+
-wmi, --with-manual-import <with-manual-import> A remapped function name to be treated as a manual import during binding generation. Supports wildcards. []
181
+
-wn, --with-namespace <with-namespace> A namespace to be used for the given remapped declaration name during binding generation. Supports wildcards. []
182
+
-wp, --with-packing <with-packing> Overrides the StructLayoutAttribute.Pack property for the given type. Supports wildcards. []
183
+
-wsle, --with-setlasterror <with-setlasterror> Add the SetLastError=true modifier to a given DllImport or UnmanagedFunctionPointer. Supports wildcards. []
182
184
-wsgct, --with-suppressgctransition <with-suppressgctransition> Add the SuppressGCTransition calling convention to a given DllImport or UnmanagedFunctionPointer. Supports wildcards. []
183
-
-wts, --with-transparent-struct <with-transparent-struct> A remapped type name to be treated as a transparent wrapper during binding generation. Supports wildcards. []
184
-
-wt, --with-type <with-type> A type to be used for the given enum declaration during binding generation. Supports wildcards. []
185
-
-wu, --with-using <with-using> A using directive to be included for the given remapped declaration name during binding generation. Supports wildcards. []
186
-
-?, -h, --help Show help and usage information
185
+
-wts, --with-transparent-struct <with-transparent-struct> A remapped type name to be treated as a transparent wrapper during binding generation. Supports wildcards. []
186
+
-wt, --with-type <with-type> A type to be used for the given enum declaration during binding generation. Supports wildcards. []
187
+
-wu, --with-using <with-using> A using directive to be included for the given remapped declaration name during binding generation. Supports wildcards. []
188
+
-?, -h, --help Show help and usage information
187
189
188
190
Wildcards:
189
191
You can use * as catch-all rule for remapping procedures. For example if you want make all of your generated code internal you can use --with-access-specifier *=Internal.
@@ -195,14 +197,26 @@ The available configuration options (visible with `-c help`) are:
195
197
196
198
Options:
197
199
?, h, help Show help and usage information for -c, --config
200
+
201
+
# Codegen Options
202
+
198
203
compatible-codegen Bindings should be generated with .NET Standard 2.0 compatibility. Setting this disables preview code generation.
199
204
default-codegen Bindings should be generated for the current LTS version of .NET/C#. This is currently .NET 6/C# 10.
200
205
latest-codegen Bindings should be generated for the current STS version of .NET/C#. This is currently .NET 7/C# 11.
201
206
preview-codegen Bindings should be generated for the preview version of .NET/C#. This is currently .NET 8/C# 12.
207
+
208
+
# File Options
209
+
202
210
single-file Bindings should be generated to a single output file. This is the default.
203
211
multi-file Bindings should be generated so there is approximately one type per file.
212
+
213
+
# Type Options
214
+
204
215
unix-types Bindings should be generated assuming Unix defaults. This is the default on Unix platforms.
205
216
windows-types Bindings should be generated assuming Windows defaults. This is the default on Windows platforms.
217
+
218
+
# Exclusion Options
219
+
206
220
exclude-anonymous-field-helpers The helper ref properties generated for fields in nested anonymous structs and unions should not be generated.
207
221
exclude-com-proxies Types recognized as COM proxies should not have bindings generated. Thes are currently function declarations ending with _UserFree, _UserMarshal, _UserSize, _UserUnmarshal, _Proxy, or _Stub.
208
222
exclude-default-remappings Default remappings for well known types should not be added. This currently includes intptr_t, ptrdiff_t, size_t, and uintptr_t
@@ -211,24 +225,39 @@ Options:
211
225
exclude-fnptr-codegen Generated bindings for latest or preview codegen should not use function pointers.
212
226
exclude-funcs-with-body Bindings for functions with bodies should not be generated.
213
227
exclude-using-statics-for-enums Enum usages should be fully qualified and should not include a corresponding 'using static EnumName;'
228
+
229
+
# Vtbl Options
230
+
214
231
explicit-vtbls VTBLs should have an explicit type generated with named fields per entry.
215
232
implicit-vtbls VTBLs should be implicit to reduce metadata bloat. This is the current default
216
233
trimmable-vtbls VTBLs should be defined but not used in helper methods to reduce metadata bloat when trimming.
234
+
235
+
# Test Options
236
+
217
237
generate-tests-nunit Basic tests validating size, blittability, and associated metadata should be generated for NUnit.
218
238
generate-tests-xunit Basic tests validating size, blittability, and associated metadata should be generated for XUnit.
239
+
240
+
# Generation Options
241
+
219
242
generate-aggressive-inlining [MethodImpl(MethodImplOptions.AggressiveInlining)] should be added to generated helper functions.
243
+
generate-callconv-member-function Instance function pointers should use [CallConvMemberFunction] where applicable.
220
244
generate-cpp-attributes [CppAttributeList("")] should be generated to document the encountered C++ attributes.
245
+
generate-disable-runtime-marshalling [assembly: DisableRuntimeMarshalling] should be generated.
221
246
generate-doc-includes <include> xml documentation tags should be generated for declarations.
222
247
generate-file-scoped-namespaces Namespaces should be scoped to the file to reduce nesting.
223
248
generate-guid-member Types with an associated GUID should have a corresponding member generated.
224
249
generate-helper-types Code files should be generated for various helper attributes and declared transparent structs.
225
250
generate-macro-bindings Bindings for macro-definitions should be generated. This currently only works with value like macros and not function-like ones.
226
251
generate-marker-interfaces Bindings for marker interfaces representing native inheritance hierarchies should be generated.
252
+
generate-native-bitfield-attribute [NativeBitfield(\"\", offset: #, length: #)] attribute should be generated to document the encountered bitfield layout.
227
253
generate-native-inheritance-attribute [NativeInheritance("")] attribute should be generated to document the encountered C++ base type.
228
254
generate-setslastsystemerror-attribute [SetsLastSystemError] attribute should be generated rather than using SetLastError = true.
229
255
generate-template-bindings Bindings for template-definitions should be generated. This is currently experimental.
230
256
generate-unmanaged-constants Unmanaged constants should be generated using static ref readonly properties. This is currently experimental.
231
257
generate-vtbl-index-attribute [VtblIndex(#)] attribute should be generated to document the underlying VTBL index for a helper method.
258
+
259
+
# Logging Options
260
+
232
261
log-exclusions A list of excluded declaration types should be generated. This will also log if the exclusion was due to an exact or partial match.
233
262
log-potential-typedef-remappings A list of potential typedef remappings should be generated. This can help identify missing remappings.
234
263
log-visited-files A list of the visited files should be generated. This can help identify traversal issues.
0 commit comments