Array of Functions in MikroBasic.

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
HiEveryone
Posts: 43
Joined: 30 Nov 2012 22:01

Array of Functions in MikroBasic.

#1 Post by HiEveryone » 28 Feb 2017 12:59

Hi,

Does MikroBasic support array of functions through function pointers?

Function pointers are supported we can have

Code: Select all

typedef  FunctionType as sub procedure()
dim  function_ptr as ^FunctionType

sub procedure fct()
end sub

main:
 function_ptr = @fct
But how can one declare an array of functions?

The following throughs an "Array of functions can not be declared" error.

Code: Select all

typedef  FunctionType as sub procedure()
dim  array_function_ptr as ^TramFunctionType[2]
What is the right way to do it?

Thanks.

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: Array of Functions in MikroBasic.

#2 Post by dusan.poluga » 10 Mar 2017 09:24

Hi,

Can you try to declare it like this.

Code: Select all

typedef  FunctionType as sub procedure()
dim  function_ptr as ^FunctionType

typedef TFuncArrayPtr as ^FunctionType
dim farr as TFuncArrayPtr[2]

sub procedure fct()
end sub
Regards,
Dusan Poluga.

Post Reply

Return to “mikroBasic PRO for PIC32 General”