Skip to content

need to access data in a C anonymous union... #123

Open
@danjenkins

Description

@danjenkins

I need to access the data from a field in a C anonymous union within a struct (https://github.com/broadcastervc/ndigo/blob/master/include/Processing.NDI.structs.h#L235-L242) but I'm struggling to understand how I can make c for go output something I can use....

I tried putting my types.go file through go tool cgo -godefs types.go and replacing the types.go file with that as I'd read that I needed -godefs to make cgo understand those unions.... but I then realised I can't do that because code in cgo_helpers expects the types to be that of the C type defintion, not the full definition that the cgo tool then exports is...

Am I missing something?

The function I'm calling is this one: https://github.com/broadcastervc/ndigo/blob/master/ndigo.go#L129-L142

Theres also a separate issue where I pass in a referenced variable pVideoData which then gets made into a new Ref'd var for C cpVideoData - cpVideoData has new data from the C function.... but that never gets passed back into pVideoData.... cpVideoData/pVideoData is where I would expect to see LineStrideInBytes from the anonymous union....

Sorry, fairly new to Go and I've reached the end of my googling skills around cgo/c for go etc...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions