Re: [fpc-pascal] Registers used by calling conventions

2019-03-08 Thread Anthony Walter
Christo, that did it. Thanks.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Registers used by calling conventions

2019-03-08 Thread Christo Crause
On Sat, Mar 9, 2019 at 12:13 AM Anthony Walter  wrote:

> ... The {$asmmode intel} compiler directive changes the asm syntax of
> what's allowed in your unit, but it does not change how dissasembled code
> is displayed in the Lazarus dissasembler view. I'd like to see instructions
> dissambled in the Lazarus helper window using the Intel style. I wasn't
> referring to the asm code in the source code editor.
>

The disassembly is prepared by the debugger.  For GDB you can set the
disassemble flavour by "set disassemble-flavor intel".  In Lazarus: Tools -
Options, go to Debugger - General then look for property AssemblerStyle and
change to gdasIntel.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Registers used by calling conventions

2019-03-08 Thread Anthony Walter
Jonas, thanks I found that information useful. The pdf on page 22 says "If
the class is INTEGER, the next available register of the sequence %rdi,
%rsi, %rdx, %rcx, %r8 and %r9 is used"

Silvio, maybe I was unclear in my second question. The {$asmmode intel}
compiler directive changes the asm syntax of what's allowed in your unit,
but it does not change how dissasembled code is displayed in the Lazarus
dissasembler view. I'd like to see instructions dissambled in the Lazarus
helper window using the Intel style. I wasn't referring to the asm code in
the source code editor.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Registers used by calling conventions

2019-03-08 Thread silvioprog
On Fri, Mar 8, 2019 at 6:34 PM Anthony Walter  wrote:

> What registers are used by default calling convention and where can I find
> more information about Free Pascal asm details?
>

For linux64 the default C.C is sysv x64. Some links with info you are
looking for:

1. https://bugs.freepascal.org/view.php?id=34743 (a low-level
Delphi-like invoke() almost done for Linux x86_64)
2. https://www3.nd.edu/~dthain/courses/cse40243/fall2017/intel-intro.html
(Introduction to X86-64 Assembly for Compiler Writers)
3. https://www.uclibc.org/docs/psABI-x86_64.pdf (System V ABI [AMD64])
4. https://wiki.osdev.org/System_V_ABI (some related links)

[]

> Also is it possible to get the Lazarus assembler to show instructions in
> Intel mode rather than AT&T?
>

Yes, just change the $asmmode to the syntax you want, e.g {$asmmode intel}.

--
Silvio Clécio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Registers used by calling conventions

2019-03-08 Thread Jonas Maebe

On 08/03/2019 22:33, Anthony Walter wrote:
Checking registers in Lazarus on 64 bit Linux, I see the default calling 
convention is using RSI and RDI, the source and destination index registers.


For any platform except for i386, FPC uses the official ABI.

The Win64 calling convention is documented by Microsoft: 
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2017


Other x86-64 platforms use the standard calling convention for that 
platform: https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Registers used by calling conventions

2019-03-08 Thread Anthony Walter
What registers are used by default calling convention and where can I find
more information about Free Pascal asm details?

When writing code using the asm block on Delphi in Windows, the default
calling convention (fastcall) would pass arguments in registers EAX, EDX,
ECX then the stack in that order.

Checking registers in Lazarus on 64 bit Linux, I see the default calling
convention is using RSI and RDI, the source and destination index registers.

Also is it possible to get the Lazarus assembler to show instructions in
Intel mode rather than AT&T?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Error: Local variables size exceeds supported limit

2019-03-08 Thread Yuriy Sydorov

On 07.03.2019 22:32, Fabio Luis Girardi wrote:

Hi All!

I'm trying to use the FPC 3.2.0 beta + Lazarus 2.0.1 with fpCEF3. But when I try compile this package with FPC 3.2.0 I 
got this error:


Error: Local variables size exceeds supported limit


It would be helpful if you provide a code snippet of a function where the error is triggered. Especially the part with 
local vars declarations, including all referenced custom types.


Yuriy.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] how to make a type private to the unit but not defining it in the implementation section?

2019-03-08 Thread Tony Whyman

I would use an "interface" type in this situation.

In the unit's "interface" section define the interface type and a 
function to create a new instance of the interface.


In the unit's implementation define all your classes including a class 
that provides the interface. The implementation of the function that 
creates a new instance of the interface should create and return a new 
instance of the class that provides the interface.


If you are using COM interfaces then you don't even need to explicitly 
destroy the interface as they are automatically deleted when all 
references go out of scope. if you use CORBA interfaces then your 
interface definition should include a method to free the interface.


On 07/03/2019 08:10, Dennis wrote:

unit frproxyserver;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Grids,
  frBase;

type

  TMyStringGrid=class(TStringGrid) //how to I make this class visible 
only to this unit?

  public
  end;

  { TProxyServerFrame }

  TProxyServerFrame = class(TBaseFrame)
    Panel_Top: TPanel;
    StringGrid1: TMyStringGrid;
  private

  public

  end;

implementation

{$R *.lfm}

end.

=
My reason is I don't want to pollute the name space but if I put the 
declaration of TMyStringGrid in the implementation section, it cannot 
be used by the field in the class declaration of TProxyServerFrame.


if there a compiler directive that I can put around
TMyStringGrid to make it only visible to the unit frproxyserver?

Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal