Hi Steve,

Yes, if it provides its own GLUT headers then that would likely be the problem. The freeglut library uses stdcall calling convention without decorated names, but it sounds like the headers you have are declaring them with a different calling convention (i.e. cdecl).

The freeglut import library should be used with the freeglut headers. Is there a way you can force this, i.e. by changing the order of your include paths so that the freeglut include directory is searched before other directories?

Regards,
Martin

On 27/04/2012 23:34, Stephen Jeffrey wrote:
Hi Martin,

The problem appears to be due to some difference between the your header files and those distributed with the CUDA library.  Below I have shown the output of various tests: (i) object code compiled using the header files provided by Martin and also CUDA; (ii) using C code compared to C++; and (iii) contents of library provided by Martin and also CUDA. If I compile and link using your header file and library, the function names are mangled in both my object code and the glut library. In this case everything works i.e the code links and can be executed. Not sure why the CUDA supplied glut is different.

cheers
steve

test_CUDA.obj (C code using glut header files provided with CUDA)
------------
00000000 N .debug$S
00000000 i .drectve
00000000 t .text
00aa766f a @comp.id
00000001 a @feat.00
         U _glutInit
00000000 T _my_function

test_CUDA.cc (C++ code using glut header files provided with CUDA)
------------
00000000 N .debug$S
00000000 i .drectve
00000000 t .text
00000000 T ?my_function@@YAXHPAPAD@Z
00ab766f a @comp.id
00000001 a @feat.00
         U _glutInit

test_Martin.c (C code using glut header files provided by Martin)
-------------
00000000 N .debug$S
00000000 i .drectve
00000000 t .text
00aa766f a @comp.id
00000001 a @feat.00
         U __imp____glutInitWithExit@12
         U _exit
00000020 t _glutInit_ATEXIT_HACK@8
00000000 T _my_function

test_Martin.cc  (C++ code using glut header files provided by Martin)
--------------
00000000 N .debug$S
00000000 i .drectve
00000000 t .text
00000000 T ?my_function@@YAXHPAPAD@Z
00ab766f a @comp.id
00000001 a @feat.00
         U __imp____glutInitWithExit@12
         U _exit
00000020 t _glutInit_ATEXIT_HACK@8

CUDA freeglut.lib
-----------------
00000000 T ___glutInitWithExit@12
00000000 I __imp____glutInitWithExit@12
00000000 I __imp__glutInit@8
00000000 T _glutInit@8

Martin's freeglut.lib
---------------------
00000000 T ___glutInitWithExit@12
00000000 I __imp____glutInitWithExit@12
00000000 I __imp__glutInit@8
00000000 T _glutInit@8