Re: Re[2]: [AD] adding new target to allegro: OpenWatcom Win32

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


> Well, I'll explain. The OpenWatcom C/C++ compiler uses its default
> custom calling convention (register-based) if another one is not
> stated clear in the function declaration,
> e.g. void __stdcall myfunc(void); // - this is STDCALL WINAPI
> convention
>
> void myfunc(void); // - this will use compilers custom one.

Wonderful ;-)  For every single function, even if it is not private to the
compilation unit?  And this can't be turned off at all?  The Watcom compiler
almost deserved its death then...

> The issue makes it problematic to use atexit() function because it
> expects a pointer to a function with compiler's default calling
> convention.

Even more wonderful ;-)  Maybe we should require the compiler not to break
ANSI C in such trivial ways before starting to port Allegro to it.

> - variables are named with preceeding underscore prefix as
>   "example_var" -> "_example_var"

What's the difference with MSVC/MinGW here?  Both define:

/* describe the asm syntax for this platform */
#define ALLEGRO_ASM_PREFIX    "_"

> - cdecl functions are named with preceeding underscore prefix
>  as "my_cdecl_func" -> "_my_cdecl_func"
>
> - stdcall functions are named with preceeding underscore prefix and
> "@"-separated number of stack bytes to release:
>  "my_stdcall_func(void)" -> "_my_stdcall_func@xxxxxxxxxx"
>
>
>  So actually I need every function declaration to be definetely made
>  with __cdecl word, as well as assembler functions to be defined
>  with a preceeding underscore.

See the macro AL_FUNC, AL_METHOD, AL_FUNCPTR.  Maybe it will be sufficient
to properly define them, maybe you'll need to invent new ones.

As for the assembly routines, they are already prefixed with an underscore
as needed (see the macro FUNC in src/i386/asmdef.c).

--
Eric Botcazou





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