Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit bba34ef

Browse files
committed
[[ Module Lcext ]] Update docs for static linking on iOS
1 parent ada53d3 commit bba34ef

File tree

1 file changed

+63
-29
lines changed

1 file changed

+63
-29
lines changed

Documentation/guides/Extending LiveCode.md

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -778,37 +778,71 @@ This can be bound to using the following:
778778

779779
##### Using compiled libraries
780780

781-
Extensions can include compiled libraries on which they depend. The
782-
libraries must be compiled for each platform and architecture they are
783-
required on and placed folders named with a platform ID in the extension
781+
Extensions can include compiled libraries on which they depend. The
782+
libraries must be compiled for each platform and architecture they are
783+
required on and placed folders named with a platform ID in the extension
784784
code folder. The platform ID folder names are in the form:
785785

786-
<architecture>-<platform>[-<options>]
787-
788-
See the [platform ID specification](https://github.com/livecode/livecode/blob/develop/docs/development/platform-id.md)
789-
for more details.
790-
791-
On all platforms with the exception of iOS, only dynamically linked
792-
libraries are supported.
793-
794-
On iOS 8+ dynamically linked frameworks (.framework) are supported and
795-
on all versions of iOS statically linked frameworks and libraries (.a)
796-
are supported. Static linking is not yet supported in iOS simulator
797-
builds.
798-
799-
If the iOS library requires linker dependencies a text file (.txt) may
800-
be included to list them in the form:
801-
802-
{library | [weak-]framework} <name>
803-
804-
Additionally, on iOS the .lcext extension is used to identify code
805-
resources that conform to the exported symbols and sectors of externals.
806-
Specifically they have a `__deps` sector that contains the content of
807-
the dependencies file mentioned above and they export a `LibInfo` struct
808-
named `__libinfoptr_<libraryname>`. Examples of generating .lcext files
809-
are available in the LiveCode source repository. This is a more
810-
efficient means of inclusion as it allows the compiler to strip unused
811-
symbols.
786+
<architecture>-<platform>[-<options>]
787+
788+
See the [platform ID](https://github.com/livecode/livecode/blob/develop/docs/development/platform-id.md)
789+
specification for more details.
790+
791+
###### Dynamic Linking
792+
793+
On all platforms with the exception of iOS devices only dynamically linked
794+
libraries are supported. Static linking is not yet supported in iOS simulator
795+
builds. On iOS 8+ devices dynamically linked frameworks (`.framework`) are
796+
supported.
797+
798+
###### Static Code Libraries for iOS Device Builds
799+
800+
Static libraries and frameworks for iOS must be compiled into a lcext object.
801+
Use the [build-module-lcext-ios.sh shell script](https://github.com/livecode/livecode/blob/develop/tools/build-module-lcext-ios.sh)
802+
as an example of how to do so.
803+
804+
The script has the following inputs in order:
805+
806+
- The path to the module compiled to C++ with using `lc-compile` with the
807+
`--forcebuiltins --outputauxc OUTPUTFILE` options. The output file inclues both
808+
the module and shims for any C foreign bindings. Use a `.cpp` extension so the
809+
compiler treats the file correctly.
810+
- The deps file which is a text file listing required dependencies when linking
811+
the object where each line is in the form `{library | [weak-]framework} <name>`
812+
- Lcext output file path (must use the lcext extesion).
813+
- The full name of the module. For example, `com.livecode.library.timezone`.
814+
- The output file path for the ios module. This should be named `module.lcm` and
815+
be next to the lcext object in the code folder. This is a dummy module we include
816+
in standalones that is just the name to be loaded as the actual module code is
817+
already linked into the executable.
818+
- one or more full paths to static libraries. If linking a static framework the
819+
static library is located at `<name>.framework/<name>`
820+
821+
###### Java and Android Libraries
822+
823+
Libraries to load on android (`.jar` & `.aar`) may be placed in the code
824+
folder `jvm-android`.
825+
826+
Java libraries to load on all platforms supporting Java may be placed in the
827+
code folder `jvm`.
828+
829+
###### Example Directory Structure
830+
831+
module.lcm
832+
manifest.xml
833+
api.lcdoc
834+
library.lcb
835+
resources/image.png
836+
code/universal-mac/library.dylib
837+
code/x86-win/library.dll
838+
code/x86-linux/library.so
839+
code/x86_64-linux/library.so
840+
code/armv6-android/library.so
841+
code/jvm-android/library.aar
842+
code/jvm/library.jar
843+
code/universal-ios-iphoneos11.4/library.lcext
844+
code/universal-ios-iphoneos11.4/module.lcm
845+
code/universal-ios-iphonesimulator11.4/library.dylib
812846

813847
#### Java
814848

0 commit comments

Comments
 (0)