glfwInit: invalid pointer

Issue #11 resolved
Fabio Krapohl
created an issue

When trying to call glfwInit from glfw3, I get invalid pointer errors (different ones depending if vulkan is included (#define GLFW_INCLUDE_VULKAN) or not).

This error already happens at compile time, because, when not calling it at toplevel, the error happens before calling other functions between the call and import-c (for example printing something)

Comments (4)

  1. Fabio Krapohl reporter
    define lib
        load-library "/usr/lib/libglfw.so"
        import-c "lib.c"
            """"
                #include <GLFW/glfw3.h>
            '()
    
    using lib filter "^(glfw(.+)|GLFW(.+))$"
    
    glfwInit;
    

    The corresponding C code works:

    #include <GLFW/glfw3.h>
    
    void main() {
        glfwInit();
    }
    
  2. Leonard Ritter

    Confirmed. The problem is caused by C namespace collision. Scopes exports a symbol named regfree (contained in a regular expression library) that glfw binds to on load, and is then erroneously called.

  3. Log in to comment