Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
General
(Moderators:
FPK
,
Tomas Hajny
) »
x64 vs x86 storing function pointers
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
fphttpapp and Windows Ser...
by
Thaddy
[
Today
at 08:36:36 am]
IFS Fractals: Iterating t...
by
Boleeman
[
Today
at 08:22:50 am]
MIDI file generator - wor...
by
finlazarus
[
Today
at 02:49:40 am]
How do I use/call functio...
by
RedOctober
[
Today
at 02:43:07 am]
compiler messages suggest...
by
n7800
[
Today
at 02:35:05 am]
Interesting article about...
by
Bogen85
[
Today
at 01:06:10 am]
C operators and shift
by
Warfley
[December 07, 2024, 11:34:33 pm]
How to get hash of entire...
by
Warfley
[December 07, 2024, 09:30:24 pm]
SAVE StringGrid to PDF
by
cdbc
[December 07, 2024, 06:52:33 pm]
How to turn off Antialias...
by
n7800
[December 07, 2024, 05:30:19 pm]
Record "inheritance"/stru...
by
Thaddy
[December 07, 2024, 05:22:24 pm]
TFPHttpClient timeout err...
by
Leledumbo
[December 07, 2024, 04:56:00 pm]
Tmemo add char like typin...
by
Thaddy
[December 07, 2024, 04:41:44 pm]
Lazarus for Windows on aa...
by
msintle
[December 07, 2024, 04:33:58 pm]
Beta Version of Super Gau...
by
lainz
[December 07, 2024, 04:09:32 pm]
Breakpoint dosn't work
by
Martin_fr
[December 07, 2024, 01:36:30 pm]
The Silver Coder on YouTu...
by
silvercoder70
[December 07, 2024, 12:56:29 pm]
FreePascal version of gcc...
by
Thaddy
[December 07, 2024, 12:53:59 pm]
LCL Web Native with D2Bri...
by
BlueIcaro
[December 07, 2024, 11:13:25 am]
(SOLVED)Arrow keys in FV
by
HotShoe
[December 07, 2024, 08:28:52 am]
Hustle - A simple task ma...
by
Wesbat
[December 07, 2024, 08:24:07 am]
Game Music Emulator
by
Guva
[December 07, 2024, 04:55:43 am]
Future Composer Player
by
Guva
[December 07, 2024, 04:42:57 am]
Ancient Program
by
VisualLab
[December 07, 2024, 12:42:54 am]
Common File Dialogs Have ...
by
rvk
[December 06, 2024, 11:14:52 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: x64 vs x86 storing function pointers (Read 1125 times)
daobh
Newbie
Posts: 3
x64 vs x86 storing function pointers
«
on:
April 18, 2021, 09:34:13 pm »
Sorry if this is obvious, I've been searching and fiddling and I can't seem to figure it out...
In delphi 5, I can do something like this
Code: Pascal
[Select]
[+]
[-]
var
someprocedure
:
procedure
;
somefunction
:
function
(
a
:
integer
)
:
boolean
;
procedure
LoadAPI
(
var
T
)
;
var
Table
:
array
[
0
..
1
]
of
Pointer
absolute
T
;
begin
someprocedure
:
=
Table
[
0
]
;
somefunction
:
=
Table
[
1
]
;
end
;
But FP balks at the assignments (someprocedure := Table[0]) Is there a simple way to massage this to work or just the verbose route of...
Code: Pascal
[Select]
[+]
[-]
type
someprocedureType
=
procedure
;
somefunctionType
=
function
(
a
:
integer
)
:
boolean
;
var
someprocedure
:
someprocedureType
;
somefunction
:
somefunctionType
;
procedure
LoadAPI
(
var
T
)
;
var
Table
:
array
[
0
..
1
]
of
Pointer
absolute
T
;
begin
someprocedure
:
=
someprocedureType
(
Table
[
0
]
)
;
somefunction
:
=
somefunctionType
(
Table
[
1
]
)
;
end
;
Logged
Jonas Maebe
Hero Member
Posts: 1067
Re: x64 vs x86 storing function pointers
«
Reply #1 on:
April 18, 2021, 09:37:27 pm »
If you use {$mode delphi}, it should compile in FPC as well. In FPC syntax modes, plain pointers are indeed not type-compatible with procedural variables for increased type safety.
Logged
daobh
Newbie
Posts: 3
Re: x64 vs x86 storing function pointers
«
Reply #2 on:
April 18, 2021, 11:16:50 pm »
I'll work on that direction a bit, I tried delphi but was using ObjFPC instead since it ended up getting a little further. Will back track and play around though! Thanks!
Logged
daobh
Newbie
Posts: 3
Re: x64 vs x86 storing function pointers
«
Reply #3 on:
April 19, 2021, 04:56:08 am »
Using -Mdelphi worked after I cleaned up a couple of other minor issues.
- functions declaring var result. commented out.
- some usage of byte(hi(XX)) changed to byte(hi(word(XX))), untested but compiling
Thanks again!
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
General
(Moderators:
FPK
,
Tomas Hajny
) »
x64 vs x86 storing function pointers
TinyPortal
© 2005-2018