www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - no size for type nothrow extern (Windows) int()

reply "cal" <callumenator gmail.com> writes:
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.
Nov 10 2012
next sibling parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
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
Nov 10 2012
prev sibling next sibling parent "cal" <callumenator gmail.com> writes:
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!
Nov 10 2012
prev sibling parent "cal" <callumenator gmail.com> writes:
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!
Nov 10 2012