Thread overview
no size for type nothrow extern (Windows) int()
Nov 11, 2012
cal
Nov 11, 2012
cal
Nov 11, 2012
cal
November 11, 2012
I want to call Windows api function VirtualAlloc. I include std.c.windows.windows but get the following error from dmd 2.061 (and 2.060):

Error: no size for type nothrow extern (Windows) int()

What does this message mean? If I provide my own prototype of the function, same error.


November 11, 2012
On 11-11-2012 02:49, cal wrote:
> I want to call Windows api function VirtualAlloc. I include
> std.c.windows.windows but get the following error from dmd 2.061 (and
> 2.060):
>
> Error: no size for type nothrow extern (Windows) int()
>
> What does this message mean? If I provide my own prototype of the
> function, same error.
>
>

Can you give a self-contained repro that illustrates the problem?

Also, please use core.sys.windows.windows instead. The std.c.* package is going to be deprecated soon-ish.

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
November 11, 2012
On Sunday, 11 November 2012 at 02:55:09 UTC, Alex Rønne Petersen wrote:
> Can you give a self-contained repro that illustrates the problem?
>
> Also, please use core.sys.windows.windows instead. The std.c.* package is going to be deprecated soon-ish.

import core.sys.windows.windows;

void main()
{
  FARPROC addr1, addr2;
  auto ptr = VirtualAlloc(null, addr2-addr1, 0x00001000, 0x40);
}

I just discovered while reducing it what the error message means: FARPROC is not void* like I thought, but (int function()), so it can't be used like I tried to do above. The compiler message was a little cryptic, but obvious in hindsight. Thanks!
November 11, 2012
On Sunday, 11 November 2012 at 02:55:09 UTC, Alex Rønne Petersen wrote:
> Can you give a self-contained repro that illustrates the problem?
>
> Also, please use core.sys.windows.windows instead. The std.c.* package is going to be deprecated soon-ish.

import core.sys.windows.windows;

void main()
{
  FARPROC addr1, addr2;
  auto ptr = VirtualAlloc(null, addr2-addr1, 0x00001000, 0x40);
}

I just discovered while reducing it what the error message means: FARPROC is not void* like I thought, but (int function()), so it can't be used like I tried to do above. The compiler message was a little cryptic, but obvious in hindsight. Thanks!