Re: [AD] [WIN] dll export file patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, 6 Jun 2001, Bob wrote:

> And how do you propose we do this in an elegant way? Having code around 
> #include's is not pretty :/  Perhaps this can be included as (say) the 
> first line of allegro.h (or aintwin.h?)

I did this to create an OpenGL wrapper.  You put all your declarations
(AL_FUNC, AL_VAR, etc) into a seperate include file, then you define
AL_FUNC and AL_VAR to do whatever you want to do with with the function
declaration info, you include the file.  I ussually had the file undef
by macros at the bottom just to keep from having to do that after the
include.


Allegro's AL_FUNC was my inspiration for this BTW.


It looked like this:

GL_FUNC(type, name, decl_args, call_args) ...
#include "gl_funcs.h"

The decl_args are formal parameters like 'int x' and the call_args are
just 'x'

There are a few more details than I am letting on, but if anyone wants a
look at my glwrapper library, you are free to ask me for it privately.

It mainly involves using the gl_funcs.h file as a generator to create 
200 or so 'whatevers' needed for OpenGL.  I used it to create the 200
declarations, 200 inline function definitions to function pointers, 200
function pointers for the current version of the library loaded, 200
holders for the dll functions, 200 definitions of debug/profiling function
calls, and 200 dummy calls so I could turn the library off.

The big problem is DEBUGGING.  Its a pain in the pass to debug a program
when it steps through an opengl function because it always shows an error
as happening in gl_funcs.h.  It leaves you to wonder "but, where was
gl_funcs included from!"

The solution I thought would be to run gl_funcs through the preproccessor
for each case and save then compile that output, that way the debugger
would step through the expanded macros.

I don't think that this is a problem for users however, because they
ussually won't try to trace through allegro code.

I actually don't support doing this to Allegro.  In fact, I ussually link
my Windows Allegro programs against the static library.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/