Recent

Author Topic: calling convention alias.  (Read 4095 times)

taazz

  • Hero Member
  • *****
  • Posts: 5368
calling convention alias.
« on: May 03, 2017, 03:16:04 pm »
I seem to remember that fpc suppored aliasing the calling convention something allong the linse of.
Code: Pascal  [Select][+][-]
  1. {$IFDEF WINDOWS}
  2. {$DEFINE callconv = stdcall}
  3. {$ENDIF}
  4. {$IFDEF LINUX}
  5. {$DEFINE callconv = cdecl}
  6. {$ENDIF}
  7.  
  8. ITest = interface(IInterface)
  9.   procedure Test; callConv;
  10. end;
  11.  
but I cannot for the life of me find where I used it. Any one can shed some light on how it is declared?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12642
  • FPC developer.
Re: calling convention alias.
« Reply #1 on: May 03, 2017, 03:19:46 pm »
Many headers declare it (it can't be declared centrally since preprocessing doesn't cross unit boundaries).

You example is ok afaik, just use := to declare a macro rather than = and {$macro on}

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: calling convention alias.
« Reply #2 on: May 03, 2017, 03:48:11 pm »
Many headers declare it (it can't be declared centrally since preprocessing doesn't cross unit boundaries).
I don't mind using an include file for this, assuming that it will work from an .inc file (I see no reason that it will not).
You example is ok afaik, just use := to declare a macro rather than = and {$macro on}
yes that is what I was missing, it is a macro and I have them turned off. That should teach me to read the error messages next time. Thank you very much.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: calling convention alias.
« Reply #3 on: May 03, 2017, 03:58:20 pm »
Winapi?
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: calling convention alias.
« Reply #4 on: May 03, 2017, 05:11:47 pm »
no, interface based plugin system rewrite.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

avra

  • Hero Member
  • *****
  • Posts: 2582
    • Additional info
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Zoran

  • Hero Member
  • *****
  • Posts: 1980
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: calling convention alias.
« Reply #6 on: May 04, 2017, 01:11:50 pm »
Used for instance in ibase60.inc (https://svn.freepascal.org/svn/fpc/trunk/packages/ibase/src/ibase60.inc):

Code: Pascal  [Select][+][-]
  1. {$IFDEF Unix}
  2.   {$DEFINE extdecl:=cdecl}
  3.  
  4. ...
  5.  
  6. {$ENDIF}
  7. {$IFDEF Windows}
  8.   {$DEFINE extdecl:=stdcall}
  9. ...
  10.  
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

 

TinyPortal © 2005-2018