Mercurial > hg > vboxdotnet
comparison InteropCodeGen/gendotnet.cs @ 4:64226294e26b
Added some information on using the interop interface generator
author | Ivo Smits |
---|---|
date | Wed, 04 May 2011 21:15:22 +0200 |
parents | f1deea9c97a0 |
children |
comparison
equal
deleted
inserted
replaced
3:b0033e69105a | 4:64226294e26b |
---|---|
1 /* This script can be used to generate C# interface definitions for XPCOM | |
2 * interop, based on an xidl file. It is currently not very flexible and | |
3 * biased towards VirtualBox. | |
4 * | |
5 * To use, put the appropriate VirtualBox.xidl file in the same directory as | |
6 * the application, and run it while piping it's output to a file: | |
7 * mono InteropCodeGen.exe > VirtualBox.cs | |
8 * Then, for compatibility with the interop assembly generated by VS.Net, a | |
9 * few modifications need to be made using the following regular expressions: | |
10 * sed -i VirtualBox.cs "s/void LockMachine(\[MarshalAs(UnmanagedType.Interface)\] ISession psession, LockType plockType);/void LockMachine([MarshalAs(UnmanagedType.Interface)\] Session psession, LockType plockType);/" | |
11 * sed -i VirtualBox.cs "s/LaunchVMProcess(\[MarshalAs(UnmanagedType\.Interface)\] ISession psession,/LaunchVMProcess([MarshalAs(UnmanagedType.Interface)] Session psession,/" | |
12 * sed -i VirtualBox.cs "s/\(interface IVirtualBoxErrorInfo {\)/\1\n\tvoid dummy1();void dummy2();void dummy3();void dummy4();void dummy5(); void dummy6(); void dummy7(); void dummy8(); void dummy9(); void dummy10();/" | |
13 * Then, a few lines need to be appended to the file: | |
14 * namespace VirtualBox { | |
15 * [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)][Guid("12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D")][ComImport()]interface Session : ISession {} | |
16 * } | |
17 * Then, compile the generated file: | |
18 * gmcs -target:library -out:Interop.VirtualBox.XPCOM.dll VirtualBox.cs | |
19 */ | |
1 //+reference System.dll | 20 //+reference System.dll |
2 //+reference System.Xml.dll | 21 //+reference System.Xml.dll |
3 using System; | 22 using System; |
4 using System.Xml.XPath; | 23 using System.Xml.XPath; |
5 using System.IO; | 24 using System.IO; |