Bug 12405

Summary: MesaGLUT missing Fortran callbacks
Product: Mesa Reporter: Bill Mitchell <william.mitchell>
Component: GLUTAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Bill Mitchell 2007-09-12 08:48:46 UTC
The build for the MesaGLUT libraries is missing the Fortran callbacks, which results in unresolved references for __glutSetFCB and __glutGetFCB when using the f90gl Fortran interface to Mesa and GLUT.  This is a very simple bug -- it is just that the Fortran callback source file was omitted in the Makefile.  You just need to edit src/glut/glx/Makefile and add glut_fbc.c to the definition of SOURCES.  This is Mesa version 7.0.1.
Comment 1 Brian Paul 2007-09-12 09:34:56 UTC
Who calls __glutSetFCB and __glutGetFCB?  The application?

gcc issues a lot of warnings when compiling this file:

glut_fbc.c: In function ‘__glutSetFCB’:
glut_fbc.c:27: warning: ISO C forbids conversion of object pointer to function pointer type
glut_fbc.c:30: warning: ISO C forbids conversion of object pointer to function pointer type
etc.

If we changed the parameter (and return type) of those functions to GLUTproc it would silence the errors, but I don't know that'd effect the Fortran ABI.

Any ideas?
Comment 2 Bill Mitchell 2007-09-12 11:10:45 UTC
__glutSetFCB and __glutGetFCB are called by f90gl.  The use of the Set function is (for example):

void APIENTRY fglutDisplayFunc(GLUTdisplayFCBUSR display)
{
    __glutSetFCB(GLUT_TMP_DISPLAY,(void *)display);
    glutDisplayFunc(fortranDisplayWrapper);
}

and the use of the Get function is:

void GLUTCALLBACK fortranDisplayWrapper(void)
{
  ((GLUTdisplayFCBUSR)__glutGetFCB(GLUT_TMP_DISPLAY))();
}

If that doesn't tell you enough about whether the change is safe, I can fill in more of the details, or you can look at the source in cwrapglt.c in the f90gl distribution at http://math.nist.gov/f90gl
Comment 3 Adam Jackson 2019-05-13 16:04:24 UTC
commit 39fc89a24e778f3ff6d92e8513b652a6c598370e
Author: Brian <brian.paul@tungstengraphics.com>
Date:   Wed Sep 12 13:40:15 2007 -0600

    Add glut_fcb.c to the build and update to fix warnings (see bug 12405)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.