[gambit-list] Problem with interactive development using remote REPL of iOS Sim.

Francois Magnan magnan at categoricaldesign.com
Wed Feb 27 09:06:20 EST 2013


Hello,

I would recommend you this strategy that I tried:

1) build a static bridge to the classes of Objective-C that you need (using macros is a good idea here to generate all the FFI from lists)
2) compile that code in a static library XCode project
3) leave the Objective-C behind forever and start coding in pure Scheme, using the remote-REPL. That way you rarely need to recompile "change-label-text".

(define change-label-text
  (c-lambda ((pointer "UILabel")) void #<<c-code
            ___arg1.text = @"Text changed.";
c-code
))

This will give you quick results and a overall idea on how you can build a dynamic bridge. The dynamic bridge is a Rolls Royce in this space.
Start with the Lada.

François



On 2013-02-27, at 08:53, Marc Feeley <feeley at iro.umontreal.ca> wrote:

> 
> On 2013-02-27, at 4:03 AM, Tatsuya Tsuda <otabat at gmail.com> wrote:
> 
>> I can  create and load a loadable library with no errors. It seems that something is missing.
>> Does anyone know how to solve this kind of problem?
>> 
> 
> Given that you are compiling with -arch i386, I'm assuming you are doing these experiments on the iPhone simulator.  If I remember correctly, on the actual device dynamic loading is not available.  So your strategy is fine for debugging with the iPhone simulator but not on a real iPhone.  What you'd need is a completely dynamic bridge to Objective-C.  That way you wouldn't have to compile the files you load.  Simply loading a source file (on the simulator or real iPhone) that uses the bridge would work.  I've done some work on a dynamic Objective-C bridge (based on objc_msgSend and friends) but it is not quite finished yet.
> 
> Now back to your problem.  I believe it is a linking problem at the Objective-C level.  It seems that the selector setText: in your app and the setText: in the dynamically loaded init.o1 are not the same selector.  There must be some linking flag that you didn't use when building your app which caused the executable to be stripped of its symbol table (selector table?).  I'm not an expert with the linking options for iOS but I hope this gives you an idea for what to look for.  Note that this problem would go away with a dynamic Objective-C bridge.
> 
> Marc
> 
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list