Compile error [Delphi]

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Guest

Compile error [Delphi]

Post 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);
User avatar
xnview
Author of XnView
Posts: 44355
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Compile error [Delphi]

Post 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.
Guest

Post 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
User avatar
xnview
Author of XnView
Posts: 44355
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post 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.
daremon

Post 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