Hi,

2013/8/26 Sergei Antonov <[email protected]>:
> Hi! This is my test program:
>
> #include <windows.h>
> #include <ktmw32.h>
> int main(){
>   HANDLE transaction = CreateTransaction(NULL, NULL, 0, 0, 0, 0, L"my descr");
>   if (transaction != INVALID_HANDLE_VALUE)
>     CloseHandle(transaction);
> }
>
> == 1. Bogus warning ==
> Using x64-4.8.1-release-win32-seh-rev4.7z compilation succeeds but
> shows a warning:
>
> D:\test>gcc test.c -lkernel32 -lktmw32
> test.c: In function 'main':
> test.c:4:23: warning: initialization makes pointer from integer
> without a cast [enabled by default]
>   HANDLE transaction = CreateTransaction(NULL, NULL, 0, 0, 0, 0, L"my descr");
>                        ^

thanks, this warning is caused by missing prototypes in ktmw32.h
header.  I added it at revision 6141.

> == 2. Link error ==
> Using x32-4.8.1-release-win32-dwarf-rev4.7z also shows a warning but
> fails to link:
>
> D:\test>gcc test.c -lkernel32 -lktmw32
> test.c: In function 'main':
> test.c:4:23: warning: initialization makes pointer from integer
> without a cast [enabled by default]
>   HANDLE transaction = CreateTransaction(NULL, NULL, 0, 0, 0, 0, L"my descr");
>                        ^
> D:\Data\Temp\1\ccnbgxxV.o:test.c:(.text+0x4e): undefined reference to
> `CreateTransaction'
> collect2.exe: error: ld returned 1 exit status

This happens due missing prototype.  For 32-bit this is a
stdcall-function, and therefore symbol-decoration is different.  Due
no prototype, a cdecl-function was searched instead.

> The same link error happens with an advapi32.lib function
> RegCreateKeyTransactedW(). So it's not only CreateTransaction() or
> ktmw32.lib that cause problems in 32-bit.

Please make sure you have included winreg.h header. Additional you
have to make sure that _WIN32_WINNT is defined >= 0x0600, so that this
API is present.  This API is just available for Vista and newer OSes.

>
> Please, fix.

Regards,
Kai

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to