Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

GetDefaultPrinter

llynisa
Beginner
1,182 Views
When I try to use GetDefaultPrinter, it fails. Am I doing something wrong? I am using CVF6.6B in W2K SP3. When I run:
 
nLen = len(DefaultPrinterName)
call GetDefaultPrinter(DefaultPrinterName, nLen)

I get the error:

forrtl: severe(157): Program Exception ? access violation

Puzzled again

Alan
0 Kudos
6 Replies
Jugoslav_Dujic
Valued Contributor II
1,182 Views
You need LOC(nLen)::
BOOL GetDefaultPrinter(
  LPTSTR pszBuffer,   // printer name buffer
  LPDWORD pcchBuffer  // size of name buffer
);

LPDWORD arguments are not translated with REFERENCE attribute -- they require an explicit LOC. Steve, do you happen to know why? (My guess is "for backward compatibility").

Jugoslav
0 Kudos
Steven_L_Intel1
Employee
1,182 Views
I think this was just an oversight. We added REFERENCE and IGNORE_LOC to a lot of arguments, but it was done on a more or less manual basis. We'll need to revisit this the next time we do a "refresh" of the definitions.

Steve
0 Kudos
llynisa
Beginner
1,182 Views
Jugoslav,

Many thanks - I must remember that pesky LOC for LPDWORD. Steve, could you get the forum system to put some soft returns in lines as long as Jugoslav's? It's a pain to read and/or print.

Alan
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,182 Views
It was my error -- I forgot the terminating {/pre}
0 Kudos
Steven_L_Intel1
Employee
1,182 Views
I edited the message. Supposedly, sometime in the mysterious future, you'll be able to edit your own posts for some time after posting.

Steve
0 Kudos
Nigel_Thomas
Beginner
1,182 Views
I just got this crash with 9.1 as well. Loc(nLen) fixed it.

nigel
0 Kudos
Reply