I lost hours to find this problem, it was tricky, let me try to explain. All libraries here are based on the compile to library feature.
I needed to have a way to standardize my source code across many libraries, regarding to consts and types.
Then I created a library with a code module with the following example:
In a regular application this variables will get initialized with the values and can be used as [codemodule].Valiable
That was not totally true. I have added this library in many of the libraries that I am creating. The code module is recognized, the variables can referenced, it compile an generate the library just fine.
However if you add those libraries in apk and run you will find that all these variables are not initialized. THey are all 0
Then I have added this same library with code module to the main apk, just to declare that and inspect the values of these variables, they showed up correct.
Then I found the the rest of all other libraries linked to the sema apk are now showing correctly the values as well.
From my standpoit, it seems that the code module only got the code of process_Globals executed due the reference in the main apk. On the libraries it was not executed, besides the variables were declared.
My source code is giant to post here to demonstrate this, but it took me hours to discover this weird problem and the workaround.
I believe this is a bug, since the code module should have the process_globals executed from however is referencing the library it is part of.
Thank you,
Eduardo Elias
I needed to have a way to standardize my source code across many libraries, regarding to consts and types.
Then I created a library with a code module with the following example:
B4X:
Sub Process_Globals
'application IDs
Public cPedidoAppId As Int = 0
Public cItemAppId As Int = 1
Public cCaixaAppId As Int = 2
Public cAgendaAppId As Int = 3
End sub
In a regular application this variables will get initialized with the values and can be used as [codemodule].Valiable
That was not totally true. I have added this library in many of the libraries that I am creating. The code module is recognized, the variables can referenced, it compile an generate the library just fine.
However if you add those libraries in apk and run you will find that all these variables are not initialized. THey are all 0
Then I have added this same library with code module to the main apk, just to declare that and inspect the values of these variables, they showed up correct.
Then I found the the rest of all other libraries linked to the sema apk are now showing correctly the values as well.
From my standpoit, it seems that the code module only got the code of process_Globals executed due the reference in the main apk. On the libraries it was not executed, besides the variables were declared.
My source code is giant to post here to demonstrate this, but it took me hours to discover this weird problem and the workaround.
I believe this is a bug, since the code module should have the process_globals executed from however is referencing the library it is part of.
Thank you,
Eduardo Elias