tags:

views:

29

answers:

1

I'm using JNA to call Carbon APIs. The particular API call that I want to call takes a CFBooleanRef as a parameter. The values, kCFBooleanTrue and kCFBooleanFalse, are declared as direct extern references in the header files.

How can I get references to those two values on the Java side, so that I can pass the values to the API call ?

+1  A: 

Well, as this hasn't gotten any answer, just putting down the solution I came up with, in case anyone else needs to do this:

I ended up using Rococoa to implement my own version of NSNumber, so that I could call numberWithBool method in it, to get an instance of a NSBoolean. Which can then be used as a CFBoolean.

public interface MyNSNumber extends NSObject {
    public static final _Class CLASS = Rococoa.createClass("NSNumber", _Class.class);

    public interface _Class extends NSClass {
        ID numberWithBool(boolean value);
    }
}
Sami
It's not only acceptable to answer your own questions when nobody else has, it's encouraged that when you find a solution you post it so others can benefit. +1 - thanks for taking the time to write it up!
Mark E