Repository: brendanzab/gl-rs (language: rust)

Issue:
*const GLvoid is incompatible with *const raw::c_void
For example, lets take `glVertexAttribPointer()`, a function that in certain cases expects integer offsets in a pointer argument (actual pointer is supplied via another call). If a programmer writes code according to the [OpenGL documentation](https://www.opengl.org/sdk/docs/man/html/glVertexAttribPointer.xhtml), she might write code like this  ([full text](https://gist.github.com/vickenty/135f9ab9ed835ddef4bc)):

``` rust
let offset = 4;
gl::VertexAttribPointer(
    0, 2, gl::FLOAT, false, 0,
    offset as *const gl::types::GLvoid
);
```

But since gl::VertexAttribPointer actually expects `*const raw::c_void`, it doesn't compile:

```
main.rs:8:13: 8:47 error: mismatched types:
 expected `*const std::os::raw::c_void`,
    found `*const ()`
(expected enum `std::os::raw::c_void`,
    found ()) [E0308]
main.rs:8             offset as *const gl::types::GLvoid
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

This is due to the fact that `GLvoid` is defined as an alias to `()`, and gl::VertexAttribPointer expects `*const raw::c_void`. When gl-rs was using `libc::c_void` as a base for all GLvoid and void types and pointers, these pointer types were compatible and the code used to compile without error.

A real life example of this can be found in the [sources of gfx-rs/gfx](https://github.com/gfx-rs/gfx/blob/master/src/backend/gl/src/factory.rs#L122).



Discussion / hints:
cc. @tomaka #373


Fix patch:
diff --git a/gl_generator/generators/ty.rs b/gl_generator/generators/ty.rs
index 822e9661..b659019a 100644
--- a/gl_generator/generators/ty.rs
+++ b/gl_generator/generators/ty.rs
@@ -290,7 +290,7 @@ pub fn build_gl_aliases<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
         "pub type GLenum = super::__gl_imports::raw::c_uint;",
         "pub type GLboolean = super::__gl_imports::raw::c_uchar;",
         "pub type GLbitfield = super::__gl_imports::raw::c_uint;",
-        "pub type GLvoid = ();",
+        "pub type GLvoid = super::__gl_imports::raw::c_void;",
         "pub type GLbyte = super::__gl_imports::raw::c_char;",
         "pub type GLshort = super::__gl_imports::raw::c_short;",
         "pub type GLint = super::__gl_imports::raw::c_int;",


Test patch: