B4J Question Official Support for Chilkat in B4X

Chilkat

New Member
Licensed User
Longtime User
Hi all,

Chilkat is starting work to begin official support for B4X. The plan is provide the library download(s) for the full Chilkat API, along with reference documentation on chilkatsoft.com, and a new "B4X" language category on example-code.com with all examples generated for B4X syntax.

I'm going to post questions in this thread for advice as work is ongoing...

1st question: Would it make more sense to have separate downloads for B4J, B4A, B4I or a single download for all?

2nd question: I'm looking at Don Manfred's partial wrapper library, and I see references that are explicitly for B4A, yet I can compile and run on Windows (B4J). For example, in the ChilkatBundle.xml we have this:

<method>
<name>Initialize</name>
<comment></comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>

</parameter>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
</method>

Also, in the CkGlobalwrapper, we have this:

package de.donmanfred;

import anywheresoftware.b4a.AbsObjectWrapper;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;

import com.chilkatsoft.CkGlobal;
import com.chilkatsoft.CkString;

@Version(0.3F)
@ShortName("CkGlobal")
@Author("DonManfred")
public class CkGlobalwrapper extends AbsObjectWrapper<CkGlobal> {

Does the parameter type and imports need to be different for use in B4J and B4i? I would think so. Is the AbsObjectWrapper a technique that can be used for all platforms?
 

DonManfred

Expert
Licensed User
Longtime User
imports need to be different for use in B4J and B4i?
I can´t answer for B4i at all. But B4I is based on another language than B4A and B4J so probably you have to do it differently.
Is the AbsObjectWrapper a technique that can be used for all platforms?
Sorry, i can´t answer this as i am not using B4i.
Probably not but i can´t anwer it.

The annotations like
B4X:
@Version(0.3F)
@ShortName("CkGlobal")
@Author("DonManfred")
are inside the B4AShared.jar in the internal B4A Library folder. This reference can be used in B4A and B4J library wrappers.
 
Last edited:
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Chilkat is starting work to begin official support for B4X.
Man this is so awesome!!

Would it make more sense to have separate downloads for B4J, B4A, B4I or a single download for all?
You can do a b4xlib, in theory it will support all 3 platforms but the native code (java and objective c) could be way different and therefore have 2 separate libraries for that.

My best advice is support B4A whenever possible and create a b4i separated.


references that are explicitly for B4A,
The special object ba and other classes and modules are called like that mostly for historic reasons. Most of the time if you are not working with UI objects it will work without issue on B4J too (there isn't a bj or B4J specific object in the core libraries)
 
Upvote 0

Chilkat

New Member
Licensed User
Longtime User
Man this is so awesome!!


You can do a b4xlib, in theory it will support all 3 platforms but the native code (java and objective c) could be way different and therefore have 2 separate libraries for that.

My best advice is support B4A whenever possible and create a b4i separated.



The special object ba and other classes and modules are called like that mostly for historic reasons. Most of the time if you are not working with UI objects it will work without issue on B4J too (there isn't a bj or B4J specific object in the core libraries)
Thanks Don and Enrique! I will continue with the work and will plan for one lib supporting both B4J and B4A, and will punt B4I for sometime in the future. :)
 
Upvote 0

Chilkat

New Member
Licensed User
Longtime User
Work is progressing. Currently wondering on the Java byte array <---> B4X problem.

1) How to pass byte data to a wrapped Java method?
2) How to return byte data from a wrapped method?

I don't want to use CkString or CkByteData in the API for B4X. I'd like to just pass in/out string variables and Byte() arrays.

For example, the Pfx.ToBinary is a method that should return a byte array.
The generated XML will contain this:

<method>
<name>ToBinary</name>
<comment>Write the PFX to in-memory bytes.</comment>
<returntype>WHAT GOES HERE?</returntype>
....
</method>


And I would imagine the generated Java would look something like this:

public byte[] ToBinary(String password) {
// I can generate the Java wrapper code to return a Java byte array...
}


The question is: What is the returntype (or parameter type) that maps to a Java byte[]? Does one exist?
Is it as simple as the following?

<method>
<name>ToBinary</name>
<comment>Write the PFX to in-memory bytes.</comment>
<returntype>byte[]</returntype>
....
</method>
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Top