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

cgogen generate variable-argument lists code #9

Open
9yx opened this issue Sep 29, 2016 · 3 comments
Open

cgogen generate variable-argument lists code #9

9yx opened this issue Sep 29, 2016 · 3 comments

Comments

@9yx
Copy link

9yx commented Sep 29, 2016

Based on a bug in the cgo (golang/go#975)
cgogen generate

// Krb5buildPrincipal function as declared in krb5/krb5.h:4028
func Krb5buildPrincipal(context Krb5context, princ []*Krb5principal, rlen uint32, realm string) Krb5errorCode {
    ccontext, _ := *(*C.krb5_context)(unsafe.Pointer(&context)), cgoAllocsUnknown
    cprinc, _ := unpackArgSPKrb5principal(princ)
    crlen, _ := (C.uint)(rlen), cgoAllocsUnknown
    crealm, _ := unpackPCharString(realm)
    __ret := C.krb5_build_principal(ccontext, cprinc, crlen, crealm) //<-- here bug
    packSPKrb5principal(princ, cprinc)
    __v := (Krb5errorCode)(__ret)
    return __v
}

krb5_build_principal is variable-argument lists function

krb5_error_code KRB5_CALLCONV_C
krb5_build_principal(krb5_context context,
                     krb5_principal * princ,
                     unsigned int rlen,
                     const char * realm, ...)

when build code:

# cgo/krb5
./krb5.go:1706:11: unexpected type: ...

kerberos.yaml

@xlab
Copy link
Owner

xlab commented Sep 29, 2016

Surely, I usually just ignore these functions in manifest.
When CGO will support variadic argument lists I'll implement that in cgogen too. There is an idea of implementing a helper for that in .c and .h helpers, but variadics in C are not portable and I have no enough motivation to deal with this problem.

@xlab xlab mentioned this issue Nov 21, 2016
@xlab xlab added planned and removed wontfix labels Nov 21, 2016
@xlab xlab added enhancement and removed bug labels Feb 19, 2017
@lotodore
Copy link
Contributor

Code generation from https://github.com/cimgui/cimgui would heavily depend on this feature, because cimgui is pretty much unusable without variadic argument lists. Right now, it cannot be used at all.

Is there any chance that variadic argument lists might still be implemented?

@xlab
Copy link
Owner

xlab commented Jul 30, 2022

@lotodore
golang/go#975 no movement there for 6 freaking years :(

So it has to generate C bridge functions, if we want to have this support. Cgogen already generates bridges for the callbacks.. So it might worth a shot.

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

No branches or pull requests

3 participants