Title: RE: Win32-API and ghostscript API

Rob,
You sir are a legend! Thankyou for your help with this.

my next step is to attempt the ps2pdf as per the example code, I will let you know how it goes.
John Rogers

pseudo code from c example###
check if version 8.15 error if not ---done
define gs arguments as a structure ?
gsapi_new_instance(&minst, NULL);
gsapi_init_with_args(minst, gsargc, gsargv);
gsapi_exit(minst);
gsapi_delete_instance(minst);


-----Original Message-----
From: Sisyphus [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 23 April 2005 4:49 AM
To: Rogers, John; perl-win32-users
Subject: Re: Win32-API and ghostscript API



----- 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);


*************************************************************
Disclaimer
If this e-mail has been sent to you in error, please notify Oc�-Australia Limited immediately and delete this e-mail from your system. Any views expressed in this e-mail are those of the individual sender and may not necessarily reflect the views of Oc�-Australia Limited.

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to