modified dll/win32/opengl32/gl.c

modified   dll/win32/opengl32/opengl32.c
   Give prototypes to all functions
   Implement OpenGL thunks in assembler for Visual C++
   Nope, environment is not compiler this time, either

modified   dll/win32/opengl32/opengl32.h
   Don't use dllexport, we have a spec file

Congratulations opengl32, you now build with Visual C++

svn path=/trunk/; revision=42448
This commit is contained in:
KJK::Hyperion 2009-08-07 01:50:19 +00:00
parent 29c24f700e
commit 2161df104c
3 changed files with 18 additions and 10 deletions

View file

@ -19,12 +19,12 @@
*
* On other machines we use C to forward the calls (slow...)
*/
#include "opengl32.h"
C_ASSERT(FIELD_OFFSET(TEB, glTable) == 0xbe8);
int WINAPI glEmptyFunc0() { return 0; }
int WINAPI glEmptyFunc0( void ) { return 0; }
int WINAPI glEmptyFunc4( long l1 ) { return 0; }
int WINAPI glEmptyFunc8( long l1, long l2 ) { return 0; }
int WINAPI glEmptyFunc12( long l1, long l2, long l3 ) { return 0; }
@ -59,7 +59,7 @@ int WINAPI glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
#if defined(_M_IX86)
# define FOO(x) #x
#if __MINGW32__
#ifdef __GNUC__
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
__asm__(".align 4" "\n\t" \
".globl _"#func"@"#stack "\n\t" \
@ -67,6 +67,14 @@ __asm__(".align 4" "\n\t" \
" movl %fs:0x18, %eax" "\n\t" \
" movl 0xbe8(%eax), %eax" "\n\t" \
" jmp *"FOO((icdidx*4))"(%eax)" "\n\t");
#elif defined(_MSC_VER)
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
__declspec(naked) ret WINAPI func typeargs \
{ \
__asm { mov eax, dword ptr fs:[18h] }; \
__asm { mov eax, dword ptr [eax+0be8h] }; \
__asm { jmp dword ptr [eax+icdidx*4] }; \
}
#else
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
ret WINAPI func typeargs \

View file

@ -26,7 +26,7 @@ GLPROCESSDATA OPENGL32_processdata;
static BOOL
OPENGL32_ThreadAttach()
OPENGL32_ThreadAttach( void )
{
GLTHREADDATA* lpData = NULL;
PROC *dispatchTable = NULL;
@ -69,7 +69,7 @@ OPENGL32_ThreadAttach()
static void
OPENGL32_ThreadDetach()
OPENGL32_ThreadDetach( void )
{
GLTHREADDATA* lpData = NULL;
PROC *dispatchTable = NULL;
@ -96,7 +96,7 @@ OPENGL32_ThreadDetach()
static BOOL
OPENGL32_ProcessAttach()
OPENGL32_ProcessAttach( void )
{
SECURITY_ATTRIBUTES attrib = { sizeof (SECURITY_ATTRIBUTES), /* nLength */
NULL, /* lpSecurityDescriptor */
@ -136,7 +136,7 @@ OPENGL32_ProcessAttach()
static void
OPENGL32_ProcessDetach()
OPENGL32_ProcessDetach( void )
{
GLDRIVERDATA *icd, *icd2;
GLDCDATA *dcdata, *dcdata2;

View file

@ -103,7 +103,7 @@ extern "C" {
#ifdef APIENTRY
#undef APIENTRY
#endif /* APIENTRY */
#define APIENTRY EXPORT __stdcall
#define APIENTRY __stdcall
/* Called by the driver to set the dispatch table */
typedef DWORD (WINAPI *SetContextCallBack)( const ICDTable * );
@ -192,7 +192,7 @@ BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd );
BOOL APIENTRY rosglMakeCurrent( HDC hdc, HGLRC hglrc );
/* empty gl functions from gl.c */
int WINAPI glEmptyFunc0();
int WINAPI glEmptyFunc0( void );
int WINAPI glEmptyFunc4( long );
int WINAPI glEmptyFunc8( long, long );
int WINAPI glEmptyFunc12( long, long, long );
@ -216,7 +216,7 @@ int WINAPI glEmptyFunc56( long, long, long, long, long, long, long, long,
#ifdef OPENGL32_GL_FUNC_PROTOTYPES
#define X(func,ret,typeargs,args,icdidx,tebidx,stack) EXPORT ret WINAPI func typeargs;
#define X(func,ret,typeargs,args,icdidx,tebidx,stack) ret WINAPI func typeargs;
GLFUNCS_MACRO
#undef X