.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
Why does WINAPI work on linux?
Old
  (#1)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Why does WINAPI work on linux? - 17-04-2004

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...
  
Reply With Quote
Re: Why does WINAPI work on linux?
Old
  (#2)
Terran
Member
 
Terran's Avatar
 
Status: Offline
Posts: 431
Join Date: Jan 2004
Default Re: Why does WINAPI work on linux? - 17-04-2004

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.
  
Reply With Quote
Re: Why does WINAPI work on linux?
Old
  (#3)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Why does WINAPI work on linux? - 17-04-2004

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 )


  
Reply With Quote
Re: Why does WINAPI work on linux?
Old
  (#4)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Why does WINAPI work on linux? - 17-04-2004

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...
  
Reply With Quote
Re: Why does WINAPI work on linux?
Old
  (#5)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Why does WINAPI work on linux? - 17-04-2004

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.


  
Reply With Quote
Re: Why does WINAPI work on linux?
Old
  (#6)
Terran
Member
 
Terran's Avatar
 
Status: Offline
Posts: 431
Join Date: Jan 2004
Default Re: Why does WINAPI work on linux? - 17-04-2004

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 */
  
Reply With Quote
Re: Why does WINAPI work on linux?
Old
  (#7)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Why does WINAPI work on linux? - 17-04-2004

thanks
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com