iOS Tutorial Compile As Library

B4i v3.50 adds support for library compilation. This is similar to the feature available in B4A and B4J: https://www.b4x.com/android/forum/t...pile-your-project-to-a-library.24750/#content

This makes it easier to build reusable components and share them in multiple projects or with other developers.
It also saves compilation time and allows splitting large projects.

Compiling to a library is simple:

1. Add #LibraryName and #LibraryVersion attributes to the main module.
2. Compile with Tools - Build Server - Compile To Library (Alt + 5)

All modules except of the main module (or any other module explicitly excluded with #ExcludeFromLibrary attribute) will be compiled as a static library.

As the main module is excluded, other modules cannot directly reference it or compilation will fail.
Note that you can use CallSub to call subs in excluded modules.

The output is made of three files:
- The XML file which will be created in the additional libraries folder.
- .a and .h files will be created in the Mac Libs folder.

This means that you can immediately use the libraries.
You can choose Tools - Build Server - Download Last Build to download a zip file with the three library files.

Note that if you are using the hosted builder then you need to first receive a permission to compile a specific library. Please contact [email protected] and send your hosted builder id and the library name.
 

narek adonts

Well-Known Member
Licensed User
Longtime User

Erel

B4X founder
Staff member
Licensed User
Longtime User
I mean if for example I want to create a custom view (ex. BestTextField) and I am compiling it as a library. Is it possible to use it as myPanel.AddView(BestTextField,...) ?
You cannot do anything that you can't do with B4i code. A B4i class will never extend a UIView.

You should implement a custom view and add it with the designer.

after add #ExcludeFromLibrary to a code module ,I cannot use it directly or will throw error when compile yes?
Modules excluded from library compilation cannot be referenced. There code is not included in the compilation.
 

Markos

Active Member
Licensed User
Longtime User
You cannot do anything that you can't do with B4i code. A B4i class will never extend a UIView.

You should implement a custom view and add it with the designer.


Modules excluded from library compilation cannot be referenced. There code is not included in the compilation.

Hi Erel

I think the member was referring to the callsubs to reference excluded subs by oncluded subs calling same.
 

zavaree

Active Member
Licensed User
Longtime User
B4i v3.50 adds support for library compilation. This is similar to the feature available in B4A and B4J: https://www.b4x.com/android/forum/t...pile-your-project-to-a-library.24750/#content

This makes it easier to build reusable components and share them in multiple projects or with other developers.
It also saves compilation time and allows splitting large projects.

Compiling to a library is simple:

1. Add #LibraryName and #LibraryVersion attributes to the main module.
2. Compile with Tools - Build Server - Compile To Library (Alt + 5)

All modules except of the main module (or any other module explicitly excluded with #ExcludeFromLibrary attribute) will be compiled as a static library.

As the main module is excluded, other modules cannot directly reference it or compilation will fail.
Note that you can use CallSub to call subs in excluded modules.

The output is made of three files:
- The XML file which will be created in the additional libraries folder.
- .a and .h files will be created in the Mac Libs folder.

This means that you can immediately use the libraries.
You can choose Tools - Build Server - Download Last Build to download a zip file with the three library files.

Note that if you are using the hosted builder then you need to first receive a permission to compile a specific library. Please contact [email protected] and send your hosted builder id and the library name.

Hi Erel

I have this error when compile my lib
what is the reason??

B4i Version: 4.81
Parsing code. (0.01s)
Compiling code. (0.13s)
Building XML file. (0.00s)
Building Xcode project (0.24s)
Sending data to remote compiler. Error
Missing permission for library compilation.
 
Top