The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Win32::API::Type - C type support package for Win32::API

SYNOPSIS

use Win32::API;

Win32::API::Type->typedef( 'my_number', 'LONG' );

ABSTRACT

This module is a support package for Win32::API that implements C types for the import with prototype functionality.

See Win32::API for more info about its usage.

DESCRIPTION

This module is automatically imported by Win32::API, so you don't need to 'use' it explicitly. These are the methods of this package:

typedef NAME, TYPE

This method defines a new type named NAME. This actually just creates an alias for the already-defined type TYPE, which you can use as a parameter in a Win32::API call.

When TYPE contains a Win32::API::Struct type declared with "typedef" in Win32::API::Struct with " *" postfixed to TYPE parameter, NAME will be a alias for the pointer version of the struct type. Creating an alias for a struct type is not supported, you have to call "typedef" in Win32::API::Struct again. Passing a struct type as TYPE without the " *" postfix is not supported.

Warns and returns undef if TYPE is unknown, else returns true.

sizeof TYPE

This returns the size, in bytes, of TYPE. Acts just like the C function of the same name.

is_known TYPE

Returns true if TYPE is known by Win32::API::Type, false otherwise.

SUPPORTED TYPES

This module recognizes many commonly used types defined in the Win32 Platform SDK header files, but not all. Types less than 13 years old are very unlikely to be the in built type database.

Please see the source for this module, in the __DATA__ section, for the full list of builtin supported types.

NOTES ON SELECT TYPES

LPVOID

Due to poor design, currently LPVOID is a char *, a string, not a number. It should really be a number. It is suggested to replace LPVOID in your C prototypes passed to Win32::API with UINT_PTR which is a pointer sized number.

SOMETYPE **

Currently ** types do not parse.

void **

Replace void ** in your C prototype that you pass to Win32::API::More with LPHANDLE.

unsigned char
signed char

These 2 types by name force numeric handling. 97 not "a". UCHAR is not a unsigned char for numeric handling purposes.

AUTHOR

Aldo Calpini ( dada@perl.it ).

MAINTAINER

Cosimo Streppone ( cosimo@cpan.org ).