.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   Why does WINAPI work on linux? (http://forums.bots-united.com/showthread.php?t=1398)

sPlOrYgOn 17-04-2004 06:08

Why does WINAPI work on linux?
 
Code:

void WINAPI GiveFnptrsToDll (enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
{
  // get the engine functions from the engine...

  memcpy (&g_engfuncs, pengfuncsFromEngine, sizeof (enginefuncs_t));
  gpGlobals = pGlobals;
}

I found that in the podbot2.6mm source code and it doesn't have #ifndef __linux__ or anything like that.
Why does this work?
DLLMain has #ifndef __linux__ around it...

Terran 17-04-2004 09:09

Re: Why does WINAPI work on linux?
 
You'll find this in other bots source too, e.g. joebot and yapb.
I never verified this but I assume it's defined somewhere in the HL SDK and the OS check is done during the definition of WINAPI.

@$3.1415rin 17-04-2004 09:40

Re: Why does WINAPI work on linux?
 
this was in the namefunc.cpp right ?
that file is only linked with the rest on windows, on linux it doesnt appear in the makefile ( if I remember that one right )

sPlOrYgOn 17-04-2004 09:48

Re: Why does WINAPI work on linux?
 
no it's the dll.cpp in podbot..
and it has the metamod functions and DLLMain and other things.
Code:

#ifndef __linux__
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
  // Required DLL entry point
  return (TRUE);
}
#endif

void WINAPI GiveFnptrsToDll (enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
{
  // get the engine functions from the engine...

  memcpy (&g_engfuncs, pengfuncsFromEngine, sizeof (enginefuncs_t));
  gpGlobals = pGlobals;
}

they're right next to each other but one is compiled in linux and one isn't. Yet podbot still compile on linux without any problems...

@$3.1415rin 17-04-2004 10:01

Re: Why does WINAPI work on linux?
 
ok, nothing like that in the namefunc, right ...

if that's there in the dll.cpp in some bots ( don't have such a bot on my hd atm ) I think that must be some calling convention definition, maybe solved to _cdecl, dunno. maybe you can try to get it using the browse function of your IDE, if that's supported.

Terran 17-04-2004 10:41

Re: Why does WINAPI work on linux?
 
from metamod/osdep.h:

Code:

// Windows uses "__declspec(dllexport)" to mark functions in the DLL that
// should be visible/callable externally.
//
// It also apparently requires WINAPI for GiveFnptrsToDll().
//
// See doc/notes_windows_coding for more information..

// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#ifdef _WIN32
                #define DLLEXPORT          __declspec(dllexport)
                // WINAPI should be provided in the windows compiler headers.
                // It's usually defined to something like "__stdcall".
#elif defined(linux)
                #define DLLEXPORT          /* */
                #define WINAPI                  /* */
#endif /* linux */


sPlOrYgOn 17-04-2004 17:52

Re: Why does WINAPI work on linux?
 
thanks


All times are GMT +2. The time now is 19:59.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.