Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Compilation Error

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Sat Mar 05, 2016 4:30 am    Post subject: Compilation Error Reply with quote

Hey guys,

I'm getting an error when trying to compile part of CEs source (using latest Lazarus release build, v1.6.1 I think).

Function that causes the error:
procedure IProcessAddress(address : WideString ; vartype : TVariableType ; showashexadecimal: Boolean=false;
showAsSigned: boolean=false; bytesize: Integer = 1; out res_address : WideString = '');stdcall;

Error Log:
    (3104) Compiling C:\Users\EH\Desktop\cheatengine-library-master\library\addresschangeunit.pas
    ..\library\addresschangeunit.pas(11,86) Error: (3337) Default values can only be specified for value, const and constref parameters
    ..\library\addresschangeunit.pas(13,1) Fatal: (10026) There were 1 errors compiling module, stopping
    Fatal: (1018) Compilation aborted
    Error: ..\Lazarus\fpc\3.0.0\bin\x86_64-win64\ppcx64.exe returned an error exitcode


The problem goes with the default parameter for the "res_address" variable, but I don't really know why it is a problem for the compiler.

Hope you guys can help me with that.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Mar 05, 2016 10:02 am    Post subject: Reply with quote

You can't use out after variables with a default value

And out can not have a default value

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Sat Mar 05, 2016 10:14 am    Post subject: Reply with quote

So how would I best fix this (best without turning the parameters)? With a "var" instead of "out"?

The whole unit (for better understanding):
Code:
unit AddressChangeUnit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, symbolhandler, byteinterpreter, CEFuncProc;

procedure IProcessAddress(address : WideString ; vartype : TVariableType ; showashexadecimal: Boolean=false;
  showAsSigned: boolean=false; bytesize: Integer = 1; out res_address : WideString = '');stdcall;

implementation

procedure IProcessAddress(address : WideString ; vartype : TVariableType ; showashexadecimal: Boolean=false;
  showAsSigned: boolean=false; bytesize: Integer = 1; out res_address : WideString = '');stdcall;
var a: PtrUInt;
  e: boolean;
begin
  //read the address and display the value it points to

  a:=symhandler.getAddressFromName(utf8toansi(address),false,e);
  if not e then
  begin
    //get the vartype and parse it
    res_address:=readAndParseAddress(a, vartype,nil,showashexadecimal, showAsSigned, bytesize);
  end
  else
    res_address:='???';
end;

end.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites