# HG changeset patch # User Ivo Smits # Date 1304536522 -7200 # Node ID 64226294e26b99239071b1c908a809488a84366b # Parent b0033e69105a23df053eaa522336f10492361754 Added some information on using the interop interface generator diff -r b0033e69105a -r 64226294e26b InteropCodeGen/gendotnet.cs --- a/InteropCodeGen/gendotnet.cs Wed May 04 16:32:10 2011 +0200 +++ b/InteropCodeGen/gendotnet.cs Wed May 04 21:15:22 2011 +0200 @@ -1,3 +1,22 @@ +/* This script can be used to generate C# interface definitions for XPCOM + * interop, based on an xidl file. It is currently not very flexible and + * biased towards VirtualBox. + * + * To use, put the appropriate VirtualBox.xidl file in the same directory as + * the application, and run it while piping it's output to a file: + * mono InteropCodeGen.exe > VirtualBox.cs + * Then, for compatibility with the interop assembly generated by VS.Net, a + * few modifications need to be made using the following regular expressions: + * sed -i VirtualBox.cs "s/void LockMachine(\[MarshalAs(UnmanagedType.Interface)\] ISession psession, LockType plockType);/void LockMachine([MarshalAs(UnmanagedType.Interface)\] Session psession, LockType plockType);/" + * sed -i VirtualBox.cs "s/LaunchVMProcess(\[MarshalAs(UnmanagedType\.Interface)\] ISession psession,/LaunchVMProcess([MarshalAs(UnmanagedType.Interface)] Session psession,/" + * 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();/" + * Then, a few lines need to be appended to the file: + * namespace VirtualBox { + * [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)][Guid("12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D")][ComImport()]interface Session : ISession {} + * } + * Then, compile the generated file: + * gmcs -target:library -out:Interop.VirtualBox.XPCOM.dll VirtualBox.cs + */ //+reference System.dll //+reference System.Xml.dll using System;