.:: 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 Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Guide : Exporting functions in Half-life mods
Old
  (#1)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Guide : Exporting functions in Half-life mods - 30-08-2004

Read it here : Guide : Exporting functions in Half-life mods

This document deals with strange declaration of GiveFnptrsToDll()
and various macros and function keywords used in HL SDK, Metamod and most of todays bots/mods for Half-life.

You have now detailed guide which can teach you :
  • What are all those extern "C", EXPORT, DLLEXPORT, WINAPI, __stdcall and _declspec(dllexport) symbols ?
  • Pesky name-decoration
  • Why do you must have .def file in your bot ?
  • How it is possible to not to use .def file under MSVC and have working bot
Wanna know more ?


I will include here the most important part : How it is possible to not to use .def file under MSVC and have working bot

If you are already using .def file :
  • delete .def file used in MSVC
  • remove all references to your .def file from your project
Change GiveFnptrsToDll()s definition to :
Code:
#if defined _WIN32
#pragma comment(linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1")
#pragma comment(linker, "/SECTION:.data,RW")
#endif

#ifndef __linux__
extern "C" void __stdcall GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine,globalvars_t *pGlobals)
#else
extern "C" void GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine,globalvars_t *pGlobals)
#endif

{
...
}
Advantages of my approach :
  • whole export procedure is controlled in one file, no need to create special .def file just for one export
  • fully compatible with HL SDKs approach. (Including making GiveFnptrsToDll first on export list and explicitly defining READ and WRITE attribute for .data section)
Note that this solution is for MSVC and linux. You have to include additional code for Borland or MingW32 to export it (But you had to do it also in old approach, hadn't you ?)



And for experienced bot coders, I have Comparing declarations of GiveFnptrsToDll() and Server_GetBlendingInterface() in bots. They may or may not find there something useful. But it should be useful at least for Pierre and Botman, because it seems they have bugs in their bots (Botmans HPB bot template and Pierres templates)


.


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)

Last edited by koraX; 30-08-2004 at 22:32..
  
Reply With Quote
Re: Guide : Exporting functions in Half-life mods
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Guide : Exporting functions in Half-life mods - 30-08-2004

Very interesting stuff here, thanks

It looks like you enjoyed it a lot, hehehe



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Guide : Exporting functions in Half-life mods
Old
  (#3)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: Guide : Exporting functions in Half-life mods - 31-08-2004

mirror is here, 'cause seems like main site is down and I can't find edit button to edit my first message. strange o_O


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: Guide : Exporting functions in Half-life mods
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Guide : Exporting functions in Half-life mods - 19-12-2004

very interesting and good written piece of tutorial there. You should do more Gonna keep that


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Reply


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

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