Interface Calling conventions

Interface Calling conventions

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Interface Calling conventions

Post by AF »

Right now there is a problem regarding Visual studio AIs vs Mingw32 spring builds.

I am struggling to get the correct exports on ym AI, I cannot get a function name handleevent using stdcall that doesnt have an @ and a number on the end.

e.g. _handleEvent@12

To get the AI t interface with spring at all requires a change which zerver reverted because it broke visual studio builds of spring, in exportdefines.h, but to get the required function names exported needs cdecl, which won't work and generates debugger messages after startup and other undefined behaviour

I'm using visual studio 2008, using mingw32 is not an option for me. I currently have deadlines to make, and this si my nubmer one stalling block for all future development at the moment.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Interface Calling conventions

Post by imbaczek »

you need a .def file, it'll fix everything. my KPAI has this:

Code: Select all

LIBRARY      "KPAI"
DESCRIPTION  'Baczek\'s Kernel Panic AI'

EXPORTS
    ; Explicit exports can go here
 	init	@1
 	handleEvent			@2
	release			@3
	getLevelOfSupportFor			@4
it's also a problem in mingw builds, but it can be solved in a different way there (-Wl,kill-at).
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Interface Calling conventions

Post by AF »

Thanks, that fixed it =]
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Interface Calling conventions

Post by AF »

I'm still getting messages like this as soon as it starts interacting more with the interface =/
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
edit :: nevermind,it seems my change to exportdefines is no longer needed thanks to the above fix, its gettng further now
Post Reply

Return to “AI”