gluonhq / gluon-samples

Gluon sample projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add sample of shared library

jperedadnr opened this issue · comments

After gluonhq/substrate#1157, provide a sample that creates a shared library.

Hi @jperedadnr is there any sample now or any guide to follow? Or would you mind providing some pointers to create shared lib for both Android and iOS?

EDIT: Just found the HelloSharedLib sample - thanks a lot!

Quick questions:

  1. Is the isolate-based approach the main way to instantiate a shared lib component?

  2. Within that Graal isolate shared lib code, can multiple additional threads be created? For example, we need to run Akka, which will need like 4 threads to schedule actors within the lib instance.

HI @jperedadnr.
I fetched your sample code.
And I built shared lib for iOS Simulator.
i tried run my code on simulator on m1 laptop(Arm/Silicone)
And faced with few errors:
First case: build shared lib for simulator. Get dylib from folder x86_64-ios and faced with error:
"Ignoring file /Users//projects/TestGraalvm/TestGraalvm/HelloSharedLib.dylib, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64" It is expected for me.
Second case: build shared lib for iOS(arm arch). Arch looks the same with real devices.
But faced with another error:
"building for iOS Simulator, but linking in dylib built for iOS, file '/Users/
/projects/TestGraalvm/TestGraalvm/HelloSharedLib.dylib' for architecture arm64"

Could you help me with correct building shared lib for simulator on M1 MacBook?