Skip to content

cmd/cgo: could we add a C.CBytes function? #14838

@jbardin

Description

@jbardin

Would it be possible to add func C.Cbytes([]byte) unsafe.Pointer to the cgo package?

I have copied the C.CString function, minus the added 0 byte a couple times, and this seems like it could be a useful addition. Granted it's only 3 lines to do the malloc and copy, but this would also serve as documentation for users needing to copy data into C.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions