gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question


From: David Chisnall
Subject: Re: Question
Date: Wed, 6 Mar 2013 20:44:58 +0000

On 6 Mar 2013, at 13:24, Laurent Michel <address@hidden> wrote:

> I went in gdb and checked. The error is raised from a call in my own code. 
> The receiver has the proper type and the method does exist.
> The way the code is organized mimics the frameworks I have on MacOS (5 of 
> them). 
> 
> Here is the backtrace. 
> 
> #18 0xb7d02f8d in -[NSObject doesNotRecognizeSelector:] (self=0x80f98e4, 
> _cmd=0xb7f71ea8, aSelector=<optimized out>) at NSObject.m:1739
> #19 0xb7d03051 in -[NSObject forwardInvocation:] (self=<optimized out>, 
> _cmd=0xb7f9c818, anInvocation=0x80f98e4) at NSObject.m:1753
> #20 0xb7db6af7 in GSFFIInvocationCallback (cif=<optimized out>, 
> retp=<optimized out>, args=<optimized out>, user=<optimized out>)
> ---Type <return> to continue, or q <return> to quit---
>    at GSFFIInvocation.m:629
> #21 0xb6f85176 in ?? () from /usr/lib/i386-linux-gnu/libffi.so.6
> #22 0xb6f85416 in ?? () from /usr/lib/i386-linux-gnu/libffi.so.6
> #23 0xb77720a3 in +[ORFactory intVar:var:shift:] (self=0xb77f6d50, 
> _cmd=0x8053a18, tracker=0x80f98e4, x=0x8178064, b=1) at ORFactory.m:214
> #24 0x0804994f in __main_block_invoke (.block_descriptor=0xbffff198, i=1) at 
> main.m:29
> #25 0xb77730c1 in +[ORFactory intVarArray:range:with:] (self=0xb77f6d50, 
> _cmd=0x8053a30, tracker=0x80f98e4, range=0x8160464, clo=0xbffff198)
>    at ORFactory.m:284
> #26 0x08048fea in main (argc=1, argv=0xbffff294) at main.m:29

So, this definitely shows that it's not finding the method.

> ORFactory is a factory class living in a shared lib ORFoundation
> The method invoked on ORModelI (a class living in a shared lib ORModeling) is 
> indeed there and compiled just fine, but he's not
> finding it. 
> 
> Here is the method in question:
> 
> 
> -(void) addConstraint: (id<ORConstraint>) cstr
> {
>   [_target trackConstraint:cstr];
>   [_target add: cstr];
> }

Is it in a category?  The class must have been loaded, if you're able to create 
instances of it...

> So the argument is just an "id" adopting a specific protocol.
> 
> The call site:
> 
>          if (b==0)
> 211         return x;
> 212      else {
> 213         id<ORIntVar> nv = [ORFactory intVar:tracker 
> domain:RANGE(tracker,[x min] + b,[x max] + b)];
> 214         [tracker addConstraint:[ORFactory equal:tracker var:nv to:x 
> plus:b annotation:DomainConsistency]];
> 215         return nv;
> 216      }
> 
> 
> where "tracker" is an ORModelI instance
> 
> (gdb) po [tracker class]
> ORModelI
> (gdb) 
> 
> So far, it all looks fine. I'll decompose line 214 to check the argument 
> being passed it (it should be a constraint (id<ORConstraint>)).
> 
> Right now, I'm thinking that the issue may be related to the fact that caller 
> and callee sit in different shared libraries and this is
> somehow causing an issue. Are there any special provisions I should be aware 
> of when creating shared libraries on Linux that contain
> objective-C code when I will have inheritance and categories spanning shared 
> lib boundaries?

This should be fine, the only problems can be if the methods are in a category 
and the category hasn't loaded.  After the start of main(), it should work 
though.

David

-- Sent from my brain




reply via email to

[Prev in Thread] Current Thread [Next in Thread]