Re[2]: [AD] adding new target to allegro: OpenWatcom Win32 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hello Eric,
Thursday, August 12, 2004, 8:20:00 PM, you wrote:
>> - I need to use compiler's default calling and naming convention
EB> What are these special calling conventions exactly? If you want to run
EB> under Windows, you have to follow the Win32 calling conventions, at least
EB> externally. So I don't see the need to use special conventions, even
EB> internally. Can you not simply use the MSVC/MinGW ones?
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.
The issue makes it problematic to use atexit() function because it
expects a pointer to a function with compiler's default calling
convention.
Besides calling convetion, there's a point about NAMING convention,
i.e. how the compiler names variables and functions. It is more
difficult here. The compiler generates names which are incompatible
with MSVC and/or MingW:
- variables are named with preceeding underscore prefix as
"example_var" -> "_example_var"
- 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.
Thank you a lot!
--
Best regards,
Juras mailto:ybxsoft@xxxxxxxxxx