error: conflicting types for Win32 API

BlitzMax Forums/Brucey's Modules/error: conflicting types for Win32 API

BlitzSupport(Posted 2016) [#1]
Hi all,

I'm trying to build an old program that uses a Win32 API call, GetSystemTimes. It used to build in non-NG BlitzMax, but for some reason that's not working with bah.serial (missing libsetupapi), so I'm trying in NG, but run into this:



This is the simple stripped-down code that produces the above:

SuperStrict

Extern "win32"
	Function GetSystemTimes:Int (lpIdleTime:Byte Ptr, lpKernelTime:Byte Ptr, lpUserTime:Byte Ptr)
End Extern


Is it a bug, or should I be changing my code here somehow?


Henri(Posted 2016) [#2]
Hi,

'GetSystemTimes' is already defined in windows.h imported somewhere along the chain, so one solution would be to create a file named <your_app>.x (or whichever file contains your extern-statement) with conflicting type defined like "WINBOOL GetSystemTimes(LPFILETIME, LPFILETIME, LPFILETIME)!" . Explanation for x.file format see this thread.

-Henri


BlitzSupport(Posted 2016) [#3]
Thanks, Henri, will look into that.


RustyKristi(Posted 2016) [#4]
Hey BlitzSupport. If you read my recent threads, this is exactly one of my issues being reported with NG.

Another option is you just remove your externs and add Import Pub.Win32. That should do it.