----- Original Message -----
From: "Sisyphus" <[EMAIL PROTECTED]>
> use warnings;
> use Win32::API;
>
> Win32::API::Struct->typedef( gsapi_revision_t => qw{
> char * product;
> char * copyright;
> long revision;
> long revisiondate;
> });
>
> my $len = 16; # = sizeof(gsapi_revision_t) on Win32
>
> Win32::API->Import('gsdll32', 'int gsapi_revision(gsapi_revision_t * pr,
int
> len)');
>
> my $revobj = Win32::API::Struct->new('gsapi_revision_t');
>
> my $ret = gsapi_revision($revobj, $len);
> print $ret, "\n"; # Expect 0 if function call succeeds
>
> print $revobj->{product}, "\n",
> $revobj->{copyright}, "\n",
> $revobj->{revision}, "\n",
> $revobj->{revisiondate}, "\n";
>
> __END__
>
The problem was that 'char *' is not understood. There's no problem with
that code if I rewrite the struct as:
Win32::API::Struct->typedef( gsapi_revision_t => qw{
LPSTR product;
LPSTR copyright;
LONG revision;
LONG revisiondate;
});
If I understand the docs correctly, the '__DATA__' section in
Win32::API::Types.pm lists all of the recognised data types.
Cheers,
Rob
PS. Also found that I can link to gsdll32.lib with MS compilers if I
prototype the gsapi_revision function as:
int __stdcall gsapi_revision (gsapi_revision_t *pr, int len);
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs