Skip to content

Commit 727237a

Browse files
authored
Merge pull request #363 from ignatandrei/NativeObjects
Native objects
2 parents fb7e77f + 9df9fce commit 727237a

47 files changed

Lines changed: 978 additions & 234 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# RSCG - 192 Examples of Roslyn Source Code Generators / 14 created by Microsoft /
1+
# RSCG - 193 Examples of Roslyn Source Code Generators / 14 created by Microsoft /
22

3-
## Latest Update : 2025-03-26 => 26 March 2025
3+
## Latest Update : 2025-03-28 => 28 March 2025
44

55
If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)***
66

@@ -20,11 +20,34 @@ If you want to be notified each time I add a new RSCG example , please click htt
2020

2121
## Content
2222

23-
Those are the 192 Roslyn Source Code Generators that I have tested you can see and download source code example.
23+
Those are the 193 Roslyn Source Code Generators that I have tested you can see and download source code example.
2424
( including 14 from Microsoft )
25+
### 193. [NativeObjects](https://ignatandrei.github.io/RSCG_Examples/v2/docs/NativeObjects) , in the [WinAPI](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#winapi) category
26+
27+
Generated on : 2025-03-28 => 28 March 2025
28+
29+
<details>
30+
<summary>Expand</summary>
31+
32+
33+
34+
Author: Kevin Gosse
35+
36+
Source generator for native interop.
37+
Generates implementation for interfaces to expose managed objects as COM-like, or call methods on COM-like native objects.
38+
39+
Nuget: [https://www.nuget.org/packages/NativeObjects/](https://www.nuget.org/packages/NativeObjects/)
40+
41+
42+
Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/NativeObjects](https://ignatandrei.github.io/RSCG_Examples/v2/docs/NativeObjects)
43+
44+
Source: [https://github.com/kevingosse/NativeObjects](https://github.com/kevingosse/NativeObjects)
45+
46+
</details>
47+
2548
### 192. [immediate.apis](https://ignatandrei.github.io/RSCG_Examples/v2/docs/immediate.apis) , in the [API](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) category
2649

27-
Generated on : 2024-09-20 => 20 September 2024
50+
Generated on : 2024-09-27 => 27 September 2024
2851

2952
<details>
3053
<summary>Expand</summary>
@@ -2388,7 +2411,7 @@ Source: [https://github.com/ignatandrei/RSCG_InterceptorTemplate](https://github
23882411

23892412
</details>
23902413

2391-
### 88. [Com](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Com) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category
2414+
### 88. [Com](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Com) , in the [WinAPI](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#winapi) category
23922415

23932416
Generated on : 2023-11-20 => 20 November 2023
23942417

later.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Just later
22

3-
## Latest Update : 2025-03-26 => 26 March 2025
3+
## Latest Update : 2025-03-28 => 28 March 2025
44

55

66

v2/Generator/all.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Nr,Key,Source,Category
8686
85,OptValidator, https://github.com/dotnet/runtime,EnhancementClass
8787
86,ConfigBinder, https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#configuration-binding-source-generator,API
8888
87,RDG, https://github.com/dotnet/aspnetcore,API
89-
88,COM, https://github.com/dotnet/runtime,EnhancementProject
89+
88,COM, https://github.com/dotnet/runtime,WinAPI
9090
89,InterceptorTemplate, https://github.com/ignatandrei/RSCG_InterceptorTemplate,Templating
9191
90,TelemetryLogging, https://github.com/dotnet/extensions,EnhancementClass
9292
91,Ling.Audit, https://github.com/ling921/dotnet-lib/,EnhancementClass
@@ -191,3 +191,4 @@ Nr,Key,Source,Category
191191
190,PMart.Enumeration, https://github.com/p-martinho/Enumeration,Enum
192192
191,rscg_demeter, https://github.com/ignatandrei/rscg_demeter/,FunctionalProgramming
193193
192,Immediate.APIs, https://github.com/immediateplatform/immediate.apis,API
194+
193,NativeObjects, https://github.com/kevingosse/NativeObjects,WinAPI

v2/RSCGExamplesData/GeneratorDataRec.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@
523523
},
524524
{
525525
"ID": "COM",
526-
"Category": 1,
526+
"Category": 28,
527527
"dtStart": "2023-11-20T00:00:00",
528528
"show": true
529529
},
@@ -1157,7 +1157,13 @@
11571157
{
11581158
"ID":"Immediate.APIs",
11591159
"Category": 15,
1160-
"dtStart": "2024-09-20T00:00:00",
1160+
"dtStart": "2024-09-27T00:00:00",
1161+
"show": true
1162+
},
1163+
{
1164+
"ID":"NativeObjects",
1165+
"Category": 28,
1166+
"dtStart": "2025-03-28T00:00:00",
11611167
"show": true
11621168
}
11631169
]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
<h1>RSCG nr 193 : NativeObjects</h1>
3+
4+
<h2>Info</h2>
5+
Nuget : <a href="https://www.nuget.org/packages/NativeObjects/" target="_blank">https://www.nuget.org/packages/NativeObjects/</a>
6+
7+
<p>You can find more details at : <a href="https://github.com/kevingosse/NativeObjects" target="_blank"> https://github.com/kevingosse/NativeObjects</a></p>
8+
9+
<p>Author :Kevin Gosse</p>
10+
11+
<p>Source : <a href="https://github.com/kevingosse/NativeObjects" target="_blank">https://github.com/kevingosse/NativeObjects</a> </p>
12+
13+
<h2>About</h2>
14+
15+
Object to IntPtr and back
16+
17+
<h2>
18+
How to use
19+
</h2>
20+
<h3>
21+
Add reference to the <a href="https://www.nuget.org/packages/NativeObjects/" target="_blank">NativeObjects</a> in the csproj
22+
</h3>
23+
<img src="images/NativeObjects/NativeObjectsDemo.csproj.png" width="580" height="580" />
24+
25+
<h3>This was for me the <b>starting</b> code</h3>
26+
27+
<br />
28+
I have <b>coded</b> the file Program.cs
29+
<br />
30+
<img src="images/NativeObjects/csFiles/Program.cs.png" width="580" height="580" />
31+
<hr />
32+
<h3>And here are the <i>generated</i> files</h3>
33+
34+
<br />
35+
The file <i>generated</i> is .ICalculator.g.cs
36+
<br />
37+
<img src="images/NativeObjects/generated/.ICalculator.g.cs.png" width="580" height="580" />
38+
39+
<br />
40+
The file <i>generated</i> is NativeObjectAttribute.g.cs
41+
<br />
42+
<img src="images/NativeObjects/generated/NativeObjectAttribute.g.cs.png" width="580" height="580" />
43+
44+
<br />
45+
The file <i>generated</i> is NativeObjectsDemo.ICalculator.g.cs
46+
<br />
47+
<img src="images/NativeObjects/generated/NativeObjectsDemo.ICalculator.g.cs.png" width="580" height="580" />
48+
49+
<br />
50+
The file <i>generated</i> is NativeObjectsDemo.IPerson.g.cs
51+
<br />
52+
<img src="images/NativeObjects/generated/NativeObjectsDemo.IPerson.g.cs.png" width="580" height="580" />
53+
54+
<p>
55+
You can download the code and this page as pdf from
56+
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/NativeObjects'>
57+
https://ignatandrei.github.io/RSCG_Examples/v2/docs/NativeObjects
58+
</a>
59+
</p>
60+
61+
62+
<p>
63+
You can see the whole list at
64+
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG'>
65+
https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG
66+
</a>
67+
</p>
68+

v2/book/list.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</head>
1818
<body>
1919
<h1>
20-
This is the list of 192 RSCG with examples =>
20+
This is the list of 193 RSCG with examples =>
2121
</h1>
2222

2323
<table >
@@ -794,6 +794,10 @@ <h1>
794794
<td>192</td>
795795
<td><a href="examples/immediate.apis.html">immediate.apis</a></td>
796796
</tr>
797+
<tr>
798+
<td>193</td>
799+
<td><a href="examples/NativeObjects.html">NativeObjects</a></td>
800+
</tr>
797801
</table>
798802

799803

v2/book/pandocHTML.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ input-files:
206206
- examples/PMart.Enumeration.html
207207
- examples/rscg_demeter.html
208208
- examples/immediate.apis.html
209+
- examples/NativeObjects.html
209210

210211
# or you may use input-file: with a single value
211212
# defaults:

v2/rscg_examples/InterceptorTemplate/src/.tours/InterceptorTemplate.tour

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -41,66 +41,6 @@
4141
}
4242

4343

44-
,{
45-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_Test_2.cs",
46-
"description": "Generated File 10 from 10 : RSCG_DemoObjects.Person_Test_2.cs ",
47-
"line": 1
48-
}
49-
50-
,{
51-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_TestFullNameWithArguments_6.cs",
52-
"description": "Generated File 9 from 10 : RSCG_DemoObjects.Person_TestFullNameWithArguments_6.cs ",
53-
"line": 1
54-
}
55-
56-
,{
57-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_ShowRandomPersonNumber_7.cs",
58-
"description": "Generated File 8 from 10 : RSCG_DemoObjects.Person_ShowRandomPersonNumber_7.cs ",
59-
"line": 1
60-
}
61-
62-
,{
63-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_PersonsLoaded_5.cs",
64-
"description": "Generated File 7 from 10 : RSCG_DemoObjects.Person_PersonsLoaded_5.cs ",
65-
"line": 1
66-
}
67-
68-
,{
69-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_PersonsLoaded_4.cs",
70-
"description": "Generated File 6 from 10 : RSCG_DemoObjects.Person_PersonsLoaded_4.cs ",
71-
"line": 1
72-
}
73-
74-
,{
75-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_FullName_3.cs",
76-
"description": "Generated File 5 from 10 : RSCG_DemoObjects.Person_FullName_3.cs ",
77-
"line": 1
78-
}
79-
80-
,{
81-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.Person_FullName_1.cs",
82-
"description": "Generated File 4 from 10 : RSCG_DemoObjects.Person_FullName_1.cs ",
83-
"line": 1
84-
}
85-
86-
,{
87-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.PersonLoader_SavePerson_8.cs",
88-
"description": "Generated File 3 from 10 : RSCG_DemoObjects.PersonLoader_SavePerson_8.cs ",
89-
"line": 1
90-
}
91-
92-
,{
93-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.PersonLoader_Connect_9.cs",
94-
"description": "Generated File 2 from 10 : RSCG_DemoObjects.PersonLoader_Connect_9.cs ",
95-
"line": 1
96-
}
97-
98-
,{
99-
"file": "RSCG_InterceptorTemplateConsole/obj/GX/RSCG_InterceptorTemplate/RSCG_InterceptorTemplate.MethodIntercept/RSCG_DemoObjects.IPersonLoader_InsertPerson_10.cs",
100-
"description": "Generated File 1 from 10 : RSCG_DemoObjects.IPersonLoader_InsertPerson_10.cs ",
101-
"line": 1
102-
}
103-
10444
],
10545

10646
"ref": "main"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"generator":{
3+
"name":"NativeObjects",
4+
"nuget":[
5+
"https://www.nuget.org/packages/NativeObjects/"
6+
],
7+
"link":"https://github.com/kevingosse/NativeObjects",
8+
"author":"Kevin Gosse",
9+
"source":"https://github.com/kevingosse/NativeObjects"
10+
},
11+
"data":{
12+
"goodFor":["Object to IntPtr and back"],
13+
"csprojDemo":"NativeObjectsDemo.csproj",
14+
"csFiles":["Program.cs","Person.cs"],
15+
"excludeDirectoryGenerated":[""],
16+
"includeAdditionalFiles":[""]
17+
},
18+
"links":{
19+
"blog":"",
20+
"video":""
21+
}
22+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Source generator for native interop.
2+
Generates implementation for interfaces to expose managed objects as COM-like, or call methods on COM-like native objects.

0 commit comments

Comments
 (0)