Is fglrendermode a function or subroutine?

Is fglrendermode a function or subroutine?

Hi
I am trying to use fglrendermode option. The Opengl book says its a function and the help library says its a function, but the compiler wants it declared as a subroutine. As a function it is supposed to return the number of mouse hits. I am confused as to how this option is to be used. Can someone help me?

Thanks
Kausik

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

fglrendermode is indeed a function but the interface in module Dfopngl is not correct.
I solved it by making a separate module with a function ownfglrendermode in which the interface is stated in the right way.
It looks as follows:

integer*4 function ownfglRenderMode  (mode ) 
!DEC$IF DEFINED(_X86_) 
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_glRenderMode@4' :: fglRenderMode 
!DEC$ELSE 
!DEC$ ATTRIBUTES STDCALL, ALIAS :  'glRenderMode'   :: fglRenderMode 
!DEC$ENDIF 
 
integer*4 mode 
 
  ownfglRenderMode = fglRenderMode(mode) 
 
end function ownfglRenderMode 

I hope this will help you.

Guus Nijhuis

Sorry for the mess in the first line of the example in the prior message.
Every "!" should start a new line, but I don't know how to get it right.

Guus

I'll fix it - the best way to show code is to bracket it in

 ... .

I agree that the declaration in DFOPNGL is wrong. We'll fix DFOPNGL in a future update.

Steve
Steve - Intel Developer Support

Hi
I pasted your fix into dfopngl.f90 and then ran my project by invoking

hits=ownfglrendermode(GL_RENDER)
(where hits is an integer)

But I still get the linker error. Am I missing something?

Thanks
Kausik

What is the linker error?

If you are not also using DFOPNGL, you'll want to add opengl32.lib, glaux.lib and glu32.lib to the list of libraries you link against.

Steve

Steve - Intel Developer Support

Hi
I pasted the fix in Dfopngl.f90 just beneath the interface for "fglrendermode" and I ran my project by invoking "ownfglrendermode". But I get the following linker error:

Linking...
xtalmouse.obj : error LNK2001: unresolved external symbol _OWNFGLRENDERMODE@4
Debug/xtaldraw_w.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Should I make any changes to "dfopngl.mod" or any others in addition to modifying dfopngl.f90?

Thanks
Kausik

Don't paste the code in DFOPNGL.F90 - that won't do a thing for you. Put it in your own code, in the routine that calls fglRenderMode.

Steve

Steve - Intel Developer Support

Hi
When I paste the following code in my routine:

interface
integer*4 function ownfglRenderMode (mode )
!DEC$IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_glRenderMode@4' :: fglRenderMode
!DEC$ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'glRenderMode' :: fglRenderMode
!DEC$ENDIF
integer*4 mode
ownfglRenderMode = fglRenderMode(mode)
end function ownfglRenderMode
end interface

I get a compiler error :

Error: This statement is invalid in an INTERFACE block.
ownfglRenderMode = fglRenderMode(mode)
^

Can someone help me ?

Thanks
Kausik

Oh, I see. I didn't look at Guus' suggestion closely enough.

Use this instead:

interface
integer*4 function ownfglRenderMode  (mode )  
!DEC$IF DEFINED(_X86_)  
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_glRenderMode@4' :: ownfglRenderMode  
!DEC$ELSE  
!DEC$ ATTRIBUTES STDCALL, ALIAS :  'glRenderMode'   :: ownfglRenderMode  
!DEC$ENDIF   
integer*4 mode 
end function ownfglRenderMode  
end interface


Steve

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today