Skip to content

Issue with interface/implementation on Windows #6

@vivekg-ai

Description

@vivekg-ai

I build the toolchain as directed in this repositories instructions. After this, I was able to build the toolchain successfully.

Having said that, I am facing the below issue -

test.mm

#import <Foundation/Foundation.h>

@interface Employee : NSObject
    -(void) helloWorld;
@end

@implementation Employee
    -(void)helloWorld{
        NSLog(@"Hello World 2");
    }
@end

int main(int argc, const char * argv[]) {
    NSLog(@"Hello World 1");
    @autoreleasepool {
        Employee *employee = [Employee new];
        [employee helloWorld];
    }
    return 0;
}

Compilation environment

clang-cl -I C:\GNUstep\x64\Release\include -fobjc-runtime=gnustep-2.0 -Xclang -fexceptions -Xclang -fobjc-exceptions -fblocks -DGNUSTEP -DGNUSTEP_WITH_DLL -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1 -D_NATIVE_OBJC_EXCEPTIONS -DGSWARN -DGSDIAGNOSE /MD /c test.mm

clang-cl test.obj C:\GNUstep\x64\Release\lib\gnustep-base.lib C:\GNUstep\x64\Release\lib\objc.lib C:\GNUstep\x64\Release\lib\dispatch.lib /MD -o test.exe

test.exe

and the output is as follows -

on Windows

2021-09-05 19:35:34.215 test[32408:17216] Hello World 1

However, on macOS I compiled it like this

clang++ test.mm -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -fobjc-arc

and the output is like -

2021-09-05 19:32:39.120 a.out[77611:5403627] Hello World 1
2021-09-05 19:32:39.120 a.out[77611:5403627] Hello World 2

So any pointers on what might be wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions