Page 1 of 1

Compile error [Delphi]

Posted: Tue Apr 13, 2004 12:25 am
by Guest
When i compile this piece of code, it raises an error:

Code: Select all

  gflGetDefaultSaveParams(lp);
  lp.FormatIndex:=gflGetFormatIndexByName(Pchar('Tiff')); //Types of actual and formal var parameters must be identical
  e:=gflSaveBitmap(PChar('test.tiff'),gfl_bmp,lp);

Re: Compile error [Delphi]

Posted: Sat Apr 24, 2004 8:45 am
by xnview
Anonymous wrote:When i compile this piece of code, it raises an error:

Code: Select all

  gflGetDefaultSaveParams(lp);
  lp.FormatIndex:=gflGetFormatIndexByName(Pchar('Tiff')); //Types of actual and formal var parameters must be identical
  e:=gflSaveBitmap(PChar('test.tiff'),gfl_bmp,lp);
Which error?
Pierre.

Posted: Sat Apr 24, 2004 2:09 pm
by Guest
if you have

Code: Select all

var
  gfl_bmp: : PGFL_BITMAP;
  sp: TGFL_SAVE_PARAMS;
then you must do
e := gflSaveBitmap(PChar('test.tiff'), gfl_bmp^, sp);
Don't forget the ^

Dimitris

Posted: Sat Apr 24, 2004 2:52 pm
by xnview
Anonymous wrote:if you have

Code: Select all

var
  gfl_bmp: : PGFL_BITMAP;
  sp: TGFL_SAVE_PARAMS;
then you must do
e := gflSaveBitmap(PChar('test.tiff'), gfl_bmp^, sp);
Don't forget the ^

Dimitris
Sorry i don't understand. Where?
Pierre.

Posted: Sat Apr 24, 2004 6:10 pm
by daremon
Sorry i don't understand. Where?
The original question was:

What is wrong with this:

Code: Select all

e := gflSaveBitmap(PChar('test.tiff'), gfl_bmp, sp);
and i answered that the correct code should be

Code: Select all

e := gflSaveBitmap(PChar('test.tiff'), gfl_bmp^, sp);
There is a symbol ^ after the variable gfl_bmp, which is needed by Delphi to dereference the pointer (something like * in C). That will solve the compile problem.

Dimitris