Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#331 TP_CALLBACK_ENVIRON is not declared

open
nobody
header (101)
5
2013-01-27
2013-01-27
Anonymous
No

The thread pool API structure called TP_CALLBACK_ENVIRON is not declared in winbase.h.

Shell is cmd.exe

> ld -v
GNU ld (GNU Binutils) 2.22.90.20120727

Windows 7 64-bit Ultimate

>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.1/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../src/gcc-4.7.1/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp --enable-lto --enable-libstdcxx-debug --enable-version-specific-ru
ntime-libs --enable-fully-dynamic-string --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdrag
on.net/bugs
Thread model: win32
gcc version 4.7.1 (tdm64-1)

This works in MS Visual Studio 2010:

#include <Windows.h>

int main()
{
TP_CALLBACK_ENVIRON tpe;
return sizeof(tpe);
}

TP_CALLBACK_ENVIRON is 40 bytes in my test.

It is a semi-opaque structure. You're supposed to use InitializeCallbackEnvironment etc to manipulate it, but you must know the size to know how much memory to allocate. Normal win32 programs can (and do) just put an instance of TP_CALLBACK_ENVIRON somewhere and take the address of it to pass it to the appropriate APIs.

Discussion


  • Anonymous
    2013-01-27

    This is the output:
    > gcc d:\Code\mingwbugrepro\mingwbugrepro\mingwbugrepro.cpp
    d:\Code\mingwbugrepro\mingwbugrepro\mingwbugrepro.cpp: In function 'int main()':
    d:\Code\mingwbugrepro\mingwbugrepro\mingwbugrepro.cpp:5:3: error: 'TP_CALLBACK_ENVIRON' was not declared in this scope
    d:\Code\mingwbugrepro\mingwbugrepro\mingwbugrepro.cpp:5:23: error: expected ';' before 'tpe'
    d:\Code\mingwbugrepro\mingwbugrepro\mingwbugrepro.cpp:6:17: error: 'tpe' was not declared in this scope