views:

98

answers:

1

I am trying to compile a program that is created from Visual Studio 8, converted it to Visual Studio 9. After giving all the required .DLL, .lib, and #include directories, I successfully compiled the program. However, when I tried to launch it, it always give out an error:

The procedure entry point SwapBuffers could not be located in the dynamic link library OpenGL32.DLL.

I checked my directories. OpenGL32.DLL does exist! I even download OpenGL32.dll again in case, mine is an old version; nope, it doesn't work. I even tried putting OpenGL32.dll right beside the built .exe. Nope, it still gives out the same error.

Do you appear to know what are some of the possible causes here?

+1  A: 

Looks like SwapBuffers functions simply isn't there. Do you get a warning on compile time about undefined references or such?

Try exploring the dll with a proper tool to view export tables and look for the function - se if it's there (google gave me this: DLL Export Viewer)

You could also try loading it dynamicly like this:

HMODULE lib = LoadLibraryA("OpenGL32.DLL");
FARPROC WINAPI proc = GetProcAddress(lib, "SwapBuffers");

if (!proc)
   printf("SwapBuffers() not found\n");

Be careful calling the function pointer proc directly without knowing the calling convention used in the dll (probably stdcall) or your stack might get malaligned.

joveha