Toffee targets

Hi,
I have a multi target library with both darwin and toffee targets. I can use the darwin ones in my toffee apps. If I do this are there any limitations ?

Cheers,
John

Hmm, good Q; this is untested, but time to find out. I think the problem will be that your Darwin target depends on Island.fx, and you cant reference that from Toffee, i think.

I’d say give it a try, and i will do too and see what needs to change if anything to support this. because we should.

but things all apart quickly.

issues:

(a) filename mismatches; island generates ClassLibrary.a, but Toffee needs libClassLibrary.a. i’, sure we can fix that; right now, a manual rename works, and the project builds, links and runs. However, that’s ojnly because the Island library is very simple.

As soon as i just add, say, a writeLn(), we hit the next issue:

(b)

                  > ld: Undefined symbols for architecture arm64:
                  > ld:   "__rtti_s", referenced from:
                  > ld:       l_.str0 in libClassLibrary.a(Class1-ded76c48bbd75420fc86503d9051a46f.o)
                  > ld:   "_ms_ta__1sConsole9_WriteLinens", referenced from:
                  > ld:       _-[Class1 Test] in libClassLibrary.a(Class1-ded76c48bbd75420fc86503d9051a46f.o)
E:                ld: symbol(s) not found for architecture arm64

`ClassLibrary now depends on stuff from Island RTL, which Toffee doesn’t reference. Of course, we can remedy that manually, but that leads us to

(c)

E:                RemObjects.Elements.System.PublishedAttribute uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Void uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.SByte uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Byte uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Single uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Double uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Int16 uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Int32 uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Int64 uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.UInt16 uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.UInt32 uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.UInt64 uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Boolean uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.Char uses the Island Object Model and is only available on Island
E:                RemObjects.Elements.System.AnsiChar uses the Island Object Model and is only available on Island
E:                An "rtl.fx" reference is missing from the project

So that’s a no-go for now.

The oposite direction might be more feasible (using a Toffee lib from an Island project

oh ok :frowning: Is that something easily fixable ?

Not sure.

Logged as bugs://E26061. for not being able to reference Island.fx from Toffee

Logged as bugs://E26062. for the binary name mismatch.

bugs://E26061 was closed as fixed.

1 Like

Does this fix allow me to do anything ?

Yes. You should be able to access and use [Cocoa] object model types form a Island-built .a/.fx pair now, when that library depends on Island.fx (which any non-stupidly-trial Island code will).

You will need to

  • reference your Island-built .fx (duh)
  • Reference (with Hint Path, as Toffee won’t be able to find it without) the matching Island.fx (and maybe .gc.fx) for your platform (e.g. Island/macOS, for a Toffee/macOS project)
  • manually rename/copy the .a file for your Island library to add a lib prefix.
1 Like