B4J Question [Solved] Library Debug vs Release

Daestrum

Expert
Licensed User
Longtime User
Is there a simple way for a library to check if it is being run against a debug (IDE) run version of an app or a release version (ie java -jar xxx).

The reason I ask is I have noticed the method signatures vary in a Class module depending on release or debug (extra parameter in debug).

Sorted - completely forgot about #if DEBUG

Sorry...

Not sorted, I need to know if app is running from IDE or jar file.
 
Last edited:

Roycefer

Well-Known Member
Licensed User
Longtime User
The double equal sign isn't a mistake. Quite the contrary, not using it is a mistake.

It crashes because there is no bounds checking. Shall I demonstrate that for you?
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
That works for what I want.
I used
B4X:
'set debugging flag in class module
ocm.debugging = Args(0)="inide"
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Thanks for the suggestions, eventually I had to go a different code route as there were differences between release and debug in the IDE runs.

In case anyone else needs to call a b4j Class module sub from a java library I found the simplest way was to add a dummy sub to the class module.
B4X:
Public Sub semaphore() ' Dummy method
End Sub
I then just check the number of parameters it expects, if none , then I call other subs as normal. If it needs 1 parameter I call them with the class instance as the first parameter.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
It was more a case of 'Can I?" as opposed to "Should I?".

I sometimes use more than one instance of a code module and needed a way to call a sub in a particular instance (not a problem with a Class module).
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
I just initialize a new instance.
That way a thread has its own copy to use.

(othercodemodule) b4j.example.othercodemodule@29a2db4d
(othercodemodule) b4j.example.othercodemodule@673c97ed
 
Upvote 0
Top