Home Help Center

Getting errors about readImpl__ and writeImpl__ in objc

hofhauserhofhauser Member Stefan HofhauserOrganization: StudentProject: Thesis
im using IceTouch 1.3 and im getting some compile time errors on slice2objc generated code.

the errors look like this:
bot.m:1695:12: No visible @interface for 'BotException' declares the selector 'writeImpl__:'
bot.m:1702:12: No visible @interface for 'BotException' declares the selector 'readImpl__:'

the code where this error occurs looks like this (this was generated by slice2objc):

-
(void) readImpl__:(id<ICEInputStream>)is_
{
    [is_ startSlice];
    [is_ endSlice];
    [super readImpl__:is_]; [COLOR="#FF0000"]<-----[/COLOR]
}

and the slice that defines BotException looks like this:
exception BotException
    {
        string message;
        StringSeq stackTrace;
    };

i can't quote understand what is causing these errors.

Comments

  • hofhauserhofhauser Member Stefan HofhauserOrganization: StudentProject: Thesis
    As far as i can tell from tracing up the inheritance tree, my custom exception ends up inheriting from ICEUserException which doesn't seem to have writeImpl method but rather just write.
    @interface ICEUserException : ICEException
    -(BOOL)usesClasses__;
    -(void)write__:(id<ICEOutputStream>)stream;
    -(void)read__:(id<ICEInputStream>)stream;
    @end
    
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    could you paste the complete Slice definitions. I have tested the BotException definition you posted, but this produce a different code that compiles fine. So there should be something else that causes the problem
    (void) readImpl__:(id<ICEInputStream>)is_
    {
        [is_ startSlice];
        self->message = [is_ newString];
        self->stackTrace = [DemoStringSeqHelper readRetained:is_];
        [is_ endSlice];
    }
    

    Regards,
    José
  • hofhauserhofhauser Member Stefan HofhauserOrganization: StudentProject: Thesis
    I have narrowed this down to the simplest possible test case:

    file bot_exceptions.ice
    module Bot
    {
        exception BotException
        {
        };
    
    };
    

    file exception.ice
    #include <bot_exceptions.ice>
    
    module Bot
    {
        exception UnsupportedOperationException
            extends ::Bot::BotException
      {
      };
    };
    

    the code generated by slice2objc (from IceTouch1.3) does not compile and fials with the following errors:
    exception.m:39:12: No visible @interface for 'BotBotException' declares the selector 'writeImpl__:'
    exception.m:46:12: No visible @interface for 'BotBotException' declares the selector 'readImpl__:'
    


    i believe this is because readImpl and writeImpl are missing from BotException interface definition in generated BotException.h (the implementations are actually in the .m files ok)
    @interface BotBotException : ICEUserException
    -(NSString *) ice_name;
    +(id) botException;
    @end
    

    and FWIW, if i put all this into a single file, the errors go away:
    module Bot
    {
        exception BotException
        {
        };
    
    };
    
    module Bot
    {
        exception UnsupportedOperationException
            extends ::Bot::BotException
      {
      };
    };
    
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Actually the problem is that the methods are missing in the declaration of ICEUserException in Ice\Exception.h

    You can just edit the header to add this missing declarations, you wont need to recompile the SDKs

    You will need to fix the headers for all SDKs, here is the list of affected headers:
    /Library/Developer/IceTouch-1.3//include/Ice/Exception.h
    /Library/Developer/IceTouch-1.3//SDKs/ObjC/iphoneos.sdk/usr/local/include/Ice/Exception.h
    /Library/Developer/IceTouch-1.3//SDKs/ObjC/iphonesimulator.sdk/usr/local/include/Ice/Exception.h
    /Library/Developer/IceTouch-1.3//SDKs/ObjC/macosx.sdk/usr/local/include/Ice/Exception.h
    

    Just update the ICEUserException to match the one bellow
    @interface ICEUserException : ICEException
    -(BOOL)usesClasses__;
    -(void)write__:(id<ICEOutputStream>)stream;
    -(void)read__:(id<ICEInputStream>)stream;
    -(void) writeImpl__:(id<ICEOutputStream>)os;
    -(void) readImpl__:(id<ICEInputStream>)is;                                             
    @end
    

    Thanks for reporting this issue, we will include the fix in next Ice Touch release.
  • hofhauserhofhauser Member Stefan HofhauserOrganization: StudentProject: Thesis
    Great, thanks a lot!
Sign In or Register to comment.