[Mono-list] Compiling egg-chicken libraries

Jonathan Gilbert 2a5gjx302@sneakemail.com
Sat, 28 Feb 2004 00:04:57


I wasn't able to make it with the example you gave (Object in VB.NET, Stub
in C#), apparently due to a bug in VB.NET (all it would tell me was "vbc :
Command line error BC2010 : compilation failed : '0xC0000005'" -- that big
hex number looks suspiciously like the win32 hardware exception code for an
illegal memory access :-). However, I was able to do it the other way around:

-----8<-----------------8<-----------------8<-----------------8<-----
[x:\test\testinterdependence\2]dir

 Volume in drive X is ELLIANA        Serial number is DCCB:1835
 Directory of  X:\test\TestInterdependence\2\*

27/02/04  23:55         <DIR>    .
27/02/04  23:55         <DIR>    ..
27/02/04  23:56             163  Object.cs
27/02/04  23:56              56  ObjectStub.cs
27/02/04  23:57             148  Stub.vb
            367 bytes in 3 files and 2 dirs    12,288 bytes allocated
  1,989,517,312 bytes free

[x:\test\testinterdependence\2]type Object.cs
namespace Test
{
  public class MyClass
  {
  }

  public class MyFoo : Foo
  {
    public override MyClass DoIt(int i) { return new MyClass(); }
  }
}

[x:\test\testinterdependence\2]type ObjectStub.cs
namespace Test
{
  public class MyClass
  {
  }
}

[x:\test\testinterdependence\2]type Stub.vb
Namespace Test
  Public MustInherit Class Foo
    Public MustOverride Function DoIt(ByVal i As Integer) As [MyClass]
  End Class
End Namespace

[x:\test\testinterdependence\2]csc /target:module /out:Object.netmodule
ObjectStub.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.


[x:\test\testinterdependence\2]vbc /target:module
/addmodule:Object.netmodule Stub.vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.


[x:\test\testinterdependence\2]csc /target:library
/addmodule:Stub.netmodule Object.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.


[x:\test\testinterdependence\2]dir *.dll

 Volume in drive X is ELLIANA        Serial number is DCCB:1835
 Directory of  X:\test\TestInterdependence\2\*.dll

27/02/04  23:57           3,072  Object.dll
          3,072 bytes in 1 file and 0 dirs    4,096 bytes allocated
  1,988,980,736 bytes free

[x:\test\testinterdependence\2]
-----8<-----------------8<-----------------8<-----------------8<-----

Jonathan

At 01:33 PM 26/02/2004 -0500, you wrote:
>The point is that you *cant* pass both files in. Pretend Object is written
in Visual Basic, and stub in C#.
>
>I did not prove this case was impossible, however I see no clear way to do
it. I would love to be proved wrong.
>
>One thing to consider is how one can make a tool that is smart enough to
know the exact steps to bootstrap. The tool cant guess-and-check. It needs
a finite set of steps that will always result in a successful compile,
given valid input. So really, you need to find a fixed and exact method,
which could be translated into code.
>
>I honestly think that it will be easier to use codedom :-).
>
>>>> "Jonathan Gilbert" <2a5gjx302@sneakemail.com> 02/26/04 12:35 PM >>>
>At 09:52 AM 26/02/2004 -0500, you wrote:
>[snip]
>>For example, if you need to have:
>>
>>Stub:
>>
>>abstract class Foo {
>>     abstract MyClass Doit (int i);
>>}
>>
>>Object:
>>class MyClass {}
>>classy MyFoo : Foo {
>>    override MyClass DoIt (int i) {}
>>}
>>
>>I don't think there is a way to bootstrap this. (well, there are some
>hacks you can do with IL code, however, it is very messy).
>[snip]
>
>1. Create Object.cs containing only:
>
>class MyClass {}
>
>2. Compile this.
>
>3. Compile Stub against this.
>
>4. Compile the true Object against Stub.
>
>..or just pass both .cs files to the C# compiler at the same time -- works
>with CSC at least :-)
>
>[x:\test\testinterdependence]csc /target:module Object.cs
>Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
>for Microsoft (R) .NET Framework version 1.1.4322
>Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
>
>Object.cs(5,17): error CS0246: The type or namespace name 'Foo' could not be
>        found (are you missing a using directive or an assembly reference?)
>
>[x:\test\testinterdependence]csc /target:module Stub.cs
>Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
>for Microsoft (R) .NET Framework version 1.1.4322
>Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
>
>Stub.cs(5,21): error CS0246: The type or namespace name 'MyClass' could
not be
>        found (are you missing a using directive or an assembly reference?)
>
>[x:\test\testinterdependence]csc /target:module Object.cs Stub.cs
>Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
>for Microsoft (R) .NET Framework version 1.1.4322
>Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
>
>
>[x:\test\testinterdependence]dir
>
> Volume in drive X is ELLIANA        Serial number is DCCB:1835
> Directory of  X:\test\TestInterdependence\*
>
>27/02/04   2:20         <DIR>    .
>27/02/04   2:20         <DIR>    ..
>27/02/04   2:18             140  Object.cs
>27/02/04   2:20           2,048  Object.netmodule
>27/02/04   2:18              94  Stub.cs
>          2,282 bytes in 3 files and 2 dirs    12,288 bytes allocated
>  1,963,778,048 bytes free
>
>[x:\test\testinterdependence]
>
>The resulting module contains types from both .cs files, of course.
>
>Jonathan
>_______________________________________________
>Mono-list maillist  -  Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>