hzzc1987 / jnaerator

Automatically exported from code.google.com/p/jnaerator
0 stars 0 forks source link

Function pointer pointers not generated well ! #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
{{{
typedef void (*f)();
void test(f* x);
struct S {
   f* pf;
};
}}}

What is the expected output? What do you see instead?
Should use Pointer or some typed structure, instead getting the raw function 
pointer (not the 
pointer to it !!)

Original issue reported on code.google.com by olivier.chafik@gmail.com on 4 Oct 2009 at 12:41

GoogleCodeExporter commented 8 years ago
Fixed in revision #863.

{{{
typedef void (*f)();
void test(f* x);
struct S {
   f* pf;
};
}}}

Now gives (added "C type" comments for non trivial types :
{{{

public static class S extends com.ochafik.lang.jnaerator.runtime.Structure<S, 
S.ByValue, S.ByReference> {
    /**
     * @see test.TestLibrary.f<br>
     * C type : f*
     */
    public com.ochafik.lang.jnaerator.parser.TypeRef.Pointer pf;
    public S() {
        super();
    }
    /**
     * @param pf @see test.TestLibrary.f<br>
     * C type : f*
     */
    public S(com.ochafik.lang.jnaerator.parser.TypeRef.Pointer pf) {
        super();
        this.pf = pf;
    }
    protected ByReference newByReference() { return new ByReference(); }
    protected ByValue newByValue() { return new ByValue(); }
    protected S newInstance() { return new S(); }
    public static S[] newArray(int arrayLength) {
        return newArray(S.class, arrayLength);
    }
    public static class ByReference extends S implements com.sun.jna.Structure.ByReference {}
    public static class ByValue extends S implements com.sun.jna.Structure.ByValue {}
}
public interface f extends com.sun.jna.Callback {
    void invoke();
}
}}}

Original comment by olivier.chafik@gmail.com on 4 Oct 2009 at 1:36