Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
questions concerning procedural types
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
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
[Solved] Need help with c...
by
Thausand
[
Today
at 08:03:53 pm]
TTagEdit Component 1.2
by
JD
[
Today
at 08:02:41 pm]
[SOLVED] progress dialog ...
by
cdbc
[
Today
at 07:55:29 pm]
Matching video to form
by
Pe3s
[
Today
at 07:41:42 pm]
[SOLVED] Form OnTop not w...
by
Pe3s
[
Today
at 07:32:12 pm]
Save record to BLOB Field
by
Sc0li0sis
[
Today
at 07:31:24 pm]
$ifdef highlighting
by
440bx
[
Today
at 07:09:02 pm]
Convert string with Key-V...
by
Warfley
[
Today
at 05:29:37 pm]
Clipboard Formats
by
AlexTP
[
Today
at 04:39:19 pm]
Lazarus Bugfix Release 4...
by
BSaidus
[
Today
at 04:17:24 pm]
[BUG REPORT] Code explore...
by
Martin_fr
[
Today
at 02:54:20 pm]
Qt6 / X11: problem with G...
by
paweld
[
Today
at 02:44:07 pm]
Dumb Problems Contest!
by
Thaddy
[
Today
at 02:41:59 pm]
Please ask about the valu...
by
zzzzzzz7
[
Today
at 02:14:52 pm]
Need help converting a C+...
by
jamie
[
Today
at 01:02:23 pm]
laz_xmlstreaming.pas fail...
by
Ryan J
[
Today
at 01:00:52 pm]
Probleme installing Lazar...
by
DonAlfredo
[
Today
at 09:05:41 am]
Wikipedia pollution
by
Thaddy
[
Today
at 08:31:35 am]
How to register a windows...
by
Thaddy
[
Today
at 08:24:15 am]
TurboBird IBX
by
rvk
[
Today
at 07:10:47 am]
append new record to arra...
by
speter
[
Today
at 12:46:02 am]
Corrupted strings
by
Aruna
[December 06, 2025, 08:25:44 pm]
Lazarus Trunc & macOS Tah...
by
Thaddy
[December 06, 2025, 05:00:57 pm]
"F2": possible bug in IDE...
by
WooBean
[December 06, 2025, 04:14:47 pm]
Problem with TSQLQuery
by
sch61
[December 06, 2025, 02:53:10 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: questions concerning procedural types (Read 920 times)
anonymousstranger
New Member
Posts: 49
questions concerning procedural types
«
on:
January 17, 2021, 02:54:42 am »
1) Given:
Code: Pascal
[Select]
[+]
[-]
Type
TOneArgCcall
=
Procedure
(
Var
X
:
integer
)
;
var
proc
:
TOneArgCcall
;
Procedure
printit
(
Var
X
:
Integer
)
;
begin
WriteLn
(
x
)
;
end
;
begin
Proc
:
=
@
printit
;
end
.
How does one pass a value into printit through proc? I'm kind of fuzzy on how this works.
2)Say you have a procedural type that references a procedure/function in a library. does the procedural type also require the "external" tag?
«
Last Edit: January 17, 2021, 03:05:41 am by anonymousstranger
»
Logged
Blaazen
Hero Member
Posts: 3241
POKE 54296,15
Re: questions concerning procedural types
«
Reply #1 on:
January 17, 2021, 03:22:35 am »
Since you pass variable x by reference (
var
), you have to write:
Code: Pascal
[Select]
[+]
[-]
var
i
:
Integer
;
begin
Proc
:
=
@
printit
;
i
:
=
5
;
Proc
(
i
)
;
end
;
i
can be global variable as well.
Don't know about external keyword.
Logged
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21
Try Eye-Candy Controls:
https://sourceforge.net/projects/eccontrols/files/
anonymousstranger
New Member
Posts: 49
Re: questions concerning procedural types
«
Reply #2 on:
January 17, 2021, 05:09:13 am »
cool
thanks.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
questions concerning procedural types
TinyPortal
© 2005-2018