@@ -9,7 +9,7 @@ IN C# already as part of P/Invoke generation so there wasn't much point in conti
99that. (Though there is something to be said for use as a starting point...)
1010
1111## Split implementation
12- This app was subsequently split into to implementations that live in distinct repositories
12+ This app was subsequently split into to implementations that now exist in distinct repositories
13131 ) Generates the EXPORTS.g.def for the Windows DLL generation from the LLVM + LIBLLVM headers
1414 1 ) This version lives in the [ LibllVM repository] ( https://github.com/UbiquityDotNET/Llvm.Libs )
15152 ) Generates the "safe handle" C# code from the LLVM + LIBLLVM headers
@@ -18,17 +18,18 @@ This app was subsequently split into to implementations that live in distinct re
1818### Common implementation
1919While there is a common implementation between the implementations (They started as simply the
2020same code and commenting out the functionality not desired) they have and will diverge over
21- time though anything in the core parsing of headers and general code generation from templates
21+ time, though anything in the core parsing of headers and general code generation from templates
2222is likely to remain. (It may be viable to support a common library for this scenario but this
2323is ONLY necessary when the native side of the interop library changes)
2424
2525## Usage
2626> [ !IMPORTANT]
2727> This project has a dependency on the ` CppSharp ` library which ONLY supports the ` X64 `
2828> architecture but the generated wrappers are NOT dependent on a particular architecture.
29- > This limits the environments that can be used to generate the sources. To simplify that
29+ > This limits the environments that can be used to generate the sources. To simplify that,
3030> the generated sources are placed into source control but generated off-line by a developer.
31- > A developer machine doing this *** MUST*** be X64 or the tool can't run.
31+ > A developer machine doing this *** MUST*** be X64 or this tool can't run. This is a limitation
32+ > defined by a dependent library.
3233
3334` LlvmBindingsGenerator -l <llvmRoot> -e <extensionsRoot> -h <HandleOutputPath> [-Diagnostics <Diagnostic>] `
3435
@@ -58,13 +59,13 @@ not used.
5859
5960#### Roslyn Source Generators - 'There be dragons there!'
6061Roslyn allows source generators directly in the compiler making for a feature similar to C++
61- template code generation AT compile time. However, there's a couple of BIG issue with that for
62+ template code generation AT compile time. However, there's a couple of BIG issues with that for
6263this particular code base.
63641 ) Non-deterministic ordering, or more specifically for this app, no way to declare the
6465 dependency on *** outputs*** of one generator as the *** input*** for another.
65662 ) Dependencies for project references
66- - As a generator for this is not general purpose they would not be published or produced
67- as a NUGET package. They only would work as a project reference. But that creates a TON
67+ - As a generator for this is not general purpose it would not be published or produced
68+ as a NUGET package. It would only work as a project reference. But that creates a TON
6869 of problems for the binary runtime dependencies of source generators, which don't flow
6970 with them as project references...
7071
@@ -114,15 +115,17 @@ how to generate the correct code.
114115 significant factor.
115116
116117#### The final choice
117- Keep using this library as a generator for the handle types. This used to work, and still does.
118+ Keep using this app as a generator for the handle types. This used to work, and still does.
118119However, this doesn't solve the problem of expressing managed code things in a custom language
119120(YAML) but it's at least a rather simplistic expression for the handles. And arguably less
120121complicated then all the subtleties of using a Roslyn Source generator for this sort of one off
121122specialized code generation.
123+
122124Solving the problem of expressing P/Invokes is simply to just manage that directly. It seemed
123125like a good idea to automate the tedium of generating those. Sadly, there are so many
124- subtleties that involve reading the docs (or source code) before you can correctly implement
125- it that there's no value in expressing all that subtlety in anything other than C#.
126+ subtleties of "special cases" that involve reading the docs (or source code) before you can
127+ correctly implement it. In the end, there's no value in expressing all that subtlety in anything
128+ other than C#.
126129
127130This also keeps the door open to use the native AST from within the source generator or an
128131analyzer to perform additional checks and ensure the hand written code matches the actual
0 commit comments