-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Strs helper for Go 1.6 cgo pointer passing rules.
This new helper creates C strings in the C heap using malloc, unlike the normal Str helper that uses Go memory. It's possible to pass it to cgo, for example, for gl.ShaderSource. This is intended usage: csources, free := gl.Strs(source) // source string ends with "\x00" gl.ShaderSource(shader, 1, csources, nil) free() Or for multiple parameters: csources, free := gl.Strs(sources...) // all strings end with "\x00" gl.ShaderSource(shader, len(sources), csources, nil) free() It returns a free func that must be called once the string is no longer needed to free memory. Pair programmed implementation of Strs with @slimsag. Fixes #31. Generated using changes in go-gl/glow#69.
- Loading branch information
Showing
13 changed files
with
559 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.