Title: RE: Win32-API and ghostscript API

Current state of play,
can start instance and delete it.   But  cant exit or use it !



##################

use warnings;
use strict;
use Win32::API;

#GS cmdline arguments
Win32::API::Struct->typedef( 'GSARGS' ,
   'LPSTR' , 'ps2pdf',
   'LPSTR' , '-dNOPAUSE',
   'LPSTR' , '-dBATCH',
   'LPSTR' , '-dSAFER',
   'LPSTR' , '-sDEVICE',
   'LPSTR' , '-sOutputFile=c:/gs/out.pdf',
   'LPSTR' , '-c',
   'LPSTR' , '.setpdfwrite',
   'LPSTR' , '-f',
   'LPSTR' , 'c:/gs/input.ps');
 
my $struct = Win32::API::Struct->new('GSARGS');
my $gsargl= $struct->sizeof('GSARGS');
print "size of stucture $gsargl\n";

Win32::API->Import('gsdll32.dll', 'int gsapi_new_instance (LPLONG **pinstance, VOID *caller_handle)' );
Win32::API->Import('gsdll32.dll', 'int gsapi_init_with_args(LPLONG *instance, INT argc, LPSTR **argv)') ;
Win32::API->Import('gsdll32.dll', 'int gsapi_exit (LPLONG *instance)');
Win32::API->Import('gsdll32.dll', 'VOID gsapi_delete_instance (LPLONG *instance)');

my $instobj = 'gs_main_instance';
my $callerhandle='';
my $ret = gsapi_new_instance($instobj,$callerhandle);
print "$instobj $callerhandle\n";
#seems I have number in instobj
if($ret > 0){print "$ret\n $^E $!";
    exit 254;}
my $ref;
#belive init with args has  pointer issue , also now think I need array not struct ?????
#$ret = gsapi_init_with_args($instobj,$gsargl,$struct);

# Generates PF at address 60  handle wrong ?
$ret = gsapi_exit($instobj);
if($ret > 0){print "$ret\n $^E $!";
    exit 253;}
#$ret = gsapi_delete_instance($instobj);
print "$ret\n";


*************************************************************
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