Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Char/VT_UI16 support missing from Variant.java/.cpp and VariantUtilities #44

Open
EJP286CRSKW opened this issue Oct 10, 2023 · 1 comment

Comments

@EJP286CRSKW
Copy link

EJP286CRSKW commented Oct 10, 2023

VT_UI16 maps naturally to Java char or java.lang.Character.

It is possible to create a Variant of type VT_UI2, by passing the value 18.

However that's it. You can't do anything else with this Variant except use it without a value. The following members are missing from Variant.java/.cpp:

public static final short VariantChar = 18;

public Variant(char c)
public char getChar()
public char getVariantChar()
public void putChar(char c)
public void putCharRef(char c)
private native void putVariantChar(char c)
private native void putVariantCharRef(char c)

and whatever is needed in the JNI to support them.

The Java code required is trivial, the same as for any other type, mutatis mutandis. Sadly I don't have the means to modify the JNI as my C++ compiler is too old, otherwise I would provide tested code in both Java and C++.

VariantUtilities also needs to deal with VT_UI16 and java.lang.Character, in variantToObject() and objectToVariant(), in the obvious ways.

This omission is curious given that SafeArray supports arrays of char in both 1D and 2D.

@freemansoft
Copy link
Owner

The free version of Visual studio comes with the correct libraries and compilers

These oddities came about because many of the updates were built by people who solved just their problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants