mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

[ObjC] Inheritance - Bindings generated in incorrect order #677

Open lemonmojo opened 6 years ago

lemonmojo commented 6 years ago

Steps to Reproduce

I usually don't have issues with inheritance and E4k but in this specific case, the bindings are generated in incorrect order, leading to the error message: error G56FB0339: attempting to use the forward class 'ELib_NativeEventArgs' as superclass of 'ELib_MessageReceivedEventArgs''.

Expected Behavior

Generate the bindings in correct order.

Actual Behavior

Bindings are generated in incorrect order leading to the error.

Environment

Embeddinator-4000 v0.1 (0.4: 7664197)

Build Logs

Building: ELib (Debug)
Build started 5/30/2018 10:06:44 AM.
__________________________________________________
Project "/Users/fx/Development/Mono/EmbeddinatorTest18/ELib/ELib.csproj" (Build target(s)):

Target _CoreCompileInterfaceDefinitions:
      BundleResources Output:
      OutputManifests Output:
Target GenerateTargetFrameworkMonikerAttribute:
  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
Target CoreCompile:
  Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
Target CopyFilesToOutputDirectory:
    ELib -> /Users/fx/Development/Mono/EmbeddinatorTest18/ELib/bin/Debug/ELib.dll
Target RunEmbeddinator:
    /Users/fx/Development/Mono/EmbeddinatorTest18/packages/Embeddinator-4000.0.4.0/tools/objcgen bin/Debug/ELib.dll --target=framework --platform=macOS-modern --abi=x86_64 --nativeexception --compile --debug --outdir=bin/Debug/
    Symbol file /Users/fx/Development/Mono/EmbeddinatorTest18/packages/Embeddinator-4000.0.4.0/tools/IKVM.Reflection.pdb doesn't match image /Users/fx/Development/Mono/EmbeddinatorTest18/packages/Embeddinator-4000.0.4.0/tools/IKVM.Reflection.dll
    Parsing assemblies...
        Parsed 'bin/Debug/ELib.dll'
    Processing assemblies...
        8 types found
    Generating binding code...
        Generated: bin/Debug/bindings.h
        Generated: bin/Debug/bindings-private.h
        Generated: bin/Debug/bindings.m
        Generated: bin/Debug/bindings.xml
        Generated: bin/Debug/embeddinator.h
        Generated: bin/Debug/glib.h
        Generated: bin/Debug/mono_embeddinator.h
        Generated: bin/Debug/mono-support.h
        Generated: bin/Debug/objc-support.h
        Generated: bin/Debug/glib.c
        Generated: bin/Debug/mono_embeddinator.c
        Generated: bin/Debug/objc-support.m
        Generated: bin/Debug/Make.config
    Compiling binding code...
    Found Mono 5.12.0.226 (between 5.4.1.7 and 5.4.1.7)
    Found Xamarin.Mac 4.5.0.280 (between 4.0.0.215 and 4.0.0.215)
        xcode-select -p
        xcrun clang -g -O0 -DNATIVEEXCEPTION -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c bin/Debug/glib.c -o bin/Debug/x86_64/glib.o 
        xcrun clang -g -O0 -DNATIVEEXCEPTION -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c bin/Debug/mono_embeddinator.c -o bin/Debug/x86_64/mono_embeddinator.o 
        xcrun clang -g -O0 -DNATIVEEXCEPTION -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c bin/Debug/objc-support.m -o bin/Debug/x86_64/objc-support.o 
        xcrun clang -g -O0 -DNATIVEEXCEPTION -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c bin/Debug/bindings.m -o bin/Debug/x86_64/bindings.o 
    In file included from bin/Debug/bindings.m:1:
    bin/Debug/bindings.h(129,44): error G56FB0339: attempting to use the forward class 'ELib_NativeEventArgs' as superclass of 'ELib_MessageReceivedEventArgs'
    @interface ELib_MessageReceivedEventArgs : ELib_NativeEventArgs {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^
    bin/Debug/bindings.h:19:8: note: forward declaration of class here
    @class ELib_NativeEventArgs;
           ^
    bin/Debug/bindings.m(491,45): error G7F6B3969: no known class method for selector 'class'
            if (self != [ELib_MessageReceivedEventArgs class])
                                                       ^~~~~
    bin/Debug/bindings.m(513,7): error G13DA7946: use of undeclared identifier '_object'; did you mean 'cObject'?
            if (!_object) {
                 ^~~~~~~
                 cObject
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AERegistry.h:77:3: note: 'cObject' declared here
      cObject                       = 'cobj', /*  0x636f626a  */
      ^
    bin/Debug/bindings.m(521,3): error G13DA7946: use of undeclared identifier '_object'
                    _object = (MonoEmbedObject *)mono_embeddinator_create_object (__instance);
                    ^
    bin/Debug/bindings.m(523,17): error G57E7A0E0: 'ELib_MessageReceivedEventArgs' cannot use 'super' because it is a root class
            return self = [super initForSuper];
                           ^
    bin/Debug/bindings.m(540,53): error G13DA7946: use of undeclared identifier '_object'
            MonoObject* __instance = mono_gchandle_get_target (_object->_handle);
                                                               ^
    bin/Debug/bindings.m(564,53): error G13DA7946: use of undeclared identifier '_object'
            MonoObject* __instance = mono_gchandle_get_target (_object->_handle);
                                                               ^
    bin/Debug/bindings.m(593,74): error G7F6B3969: no known class method for selector 'alloc'
            ELib_MessageReceivedEventArgs* __peer = [[ELib_MessageReceivedEventArgs alloc] initForSuper];
                                                                                    ^~~~~
    bin/Debug/bindings.m(594,10): error G57E7A0E0: 'ELib_MessageReceivedEventArgs' does not have a member named '_object'
            __peer->_object = (MonoEmbedObject *)mono_embeddinator_create_object (__result);
            ~~~~~~  ^
    bin/Debug/bindings.m(602,9): error G13DA7946: use of undeclared identifier '_object'
            return _object->_handle;
                   ^
    bin/Debug/bindings.m(607,17): error G57E7A0E0: 'ELib_MessageReceivedEventArgs' cannot use 'super' because it is a root class
            return self = [super initForSuper];
                           ^
    In file included from bin/Debug/bindings.m:1:
    bin/Debug/bindings.h(129,12): warning G88A71156: class 'ELib_MessageReceivedEventArgs' defined without specifying a base class [-Wobjc-root-class]
    @interface ELib_MessageReceivedEventArgs : ELib_NativeEventArgs {
               ^
    bin/Debug/bindings.h:129:41: note: add a super class to fix this problem
    @interface ELib_MessageReceivedEventArgs : ELib_NativeEventArgs {
                                            ^
                                             : NSObject 
    bin/Debug/bindings.m(677,9): warning G1B962057: incompatible pointer types returning 'ELib_ReferenceCountedObject *' from a function with result type 'ELib_NativeEventArgs *' [-Wincompatible-pointer-types]
            return __peer;
                   ^~~~~~
    2 warnings and 11 errors generated.

    Done
    /Users/fx/Development/Mono/EmbeddinatorTest18/ELib/Embeddinator-4000.targets(3,3): error MSB3073: The command "/Users/fx/Development/Mono/EmbeddinatorTest18/packages/Embeddinator-4000.0.4.0/tools/objcgen bin/Debug/ELib.dll --target=framework --platform=macOS-modern --abi=x86_64 --nativeexception --compile --debug --outdir=bin/Debug/" exited with code 1.
Done building target "RunEmbeddinator" in project "ELib.csproj" -- FAILED.

Done building project "ELib.csproj" -- FAILED.

Build FAILED.

bin/Debug/bindings.h(129,12): warning G88A71156: class 'ELib_MessageReceivedEventArgs' defined without specifying a base class [-Wobjc-root-class]
bin/Debug/bindings.m(677,9): warning G1B962057: incompatible pointer types returning 'ELib_ReferenceCountedObject *' from a function with result type 'ELib_NativeEventArgs *' [-Wincompatible-pointer-types]
bin/Debug/bindings.h(129,44): error G56FB0339: attempting to use the forward class 'ELib_NativeEventArgs' as superclass of 'ELib_MessageReceivedEventArgs'
bin/Debug/bindings.m(491,45): error G7F6B3969: no known class method for selector 'class'
bin/Debug/bindings.m(513,7): error G13DA7946: use of undeclared identifier '_object'; did you mean 'cObject'?
bin/Debug/bindings.m(521,3): error G13DA7946: use of undeclared identifier '_object'
bin/Debug/bindings.m(523,17): error G57E7A0E0: 'ELib_MessageReceivedEventArgs' cannot use 'super' because it is a root class
bin/Debug/bindings.m(540,53): error G13DA7946: use of undeclared identifier '_object'
bin/Debug/bindings.m(564,53): error G13DA7946: use of undeclared identifier '_object'
bin/Debug/bindings.m(593,74): error G7F6B3969: no known class method for selector 'alloc'
bin/Debug/bindings.m(594,10): error G57E7A0E0: 'ELib_MessageReceivedEventArgs' does not have a member named '_object'
bin/Debug/bindings.m(602,9): error G13DA7946: use of undeclared identifier '_object'
bin/Debug/bindings.m(607,17): error G57E7A0E0: 'ELib_MessageReceivedEventArgs' cannot use 'super' because it is a root class
/Users/fx/Development/Mono/EmbeddinatorTest18/ELib/Embeddinator-4000.targets(3,3): error MSB3073: The command "/Users/fx/Development/Mono/EmbeddinatorTest18/packages/Embeddinator-4000.0.4.0/tools/objcgen bin/Debug/ELib.dll --target=framework --platform=macOS-modern --abi=x86_64 --nativeexception --compile --debug --outdir=bin/Debug/" exited with code 1.
    2 Warning(s)
    12 Error(s)

Time Elapsed 00:00:02.28

---------------------- Done ----------------------

Build: 12 errors, 2 warnings

Example Project (If Possible)

https://github.com/lemonmojo/EmbeddinatorTest18