Post Reply 
How to use a forward function declaration in a program ?
12-21-2013, 09:19 PM
Post: #1
How to use a forward function declaration in a program ?
I know this must be obvious can't figure it out. I have a subroutine called by a main program that I want to move to the end of the end of the main program as follows:

EXPORT Sub1;

EXPORT Main_prog
Begin

Sub1;

End;

Sub1
Begin

End;

I'm getting a syntax error just before the Begin after the Sub1. What am I doing wrong?
Find all posts by this user
Quote this message in a reply
12-21-2013, 09:54 PM
Post: #2
RE: How to use a forward function declaration in a program ?
First export isn't necessary, but "()" is needed otherwise is a variable.

Code:
Sub1();

EXPORT Main_prog
Begin

Sub1;

End;

Sub1
Begin

End;

My website: ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
12-21-2013, 10:01 PM (This post was last modified: 12-21-2013 10:04 PM by Michael de Estrada.)
Post: #3
RE: How to use a forward function declaration in a program ?
That doesn't work either. Now I get a syntax error after the ) on the first line.

Edit, it does work w/o the EXPORT, but gives the syntax error with the EXPORT.
Find all posts by this user
Quote this message in a reply
12-21-2013, 10:05 PM
Post: #4
RE: How to use a forward function declaration in a program ?
I would try:
Code:
Sub1();

EXPORT Main_prog()
Begin

Sub1();

End;

Sub1()
Begin

End;
Or
Code:
EXPORT Sub1();

EXPORT Main_prog()
Begin

Sub1;

End;

EXPORT Sub1()
Begin

End;
Or
Code:
Sub1()
Begin

End;

EXPORT Main_prog()
Begin

Sub1();

End;
by the way, be consistent with EXPORT

Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
Find all posts by this user
Quote this message in a reply
12-21-2013, 10:11 PM
Post: #5
RE: How to use a forward function declaration in a program ?
This works, thanks guys:

PHP Code:
Sub1();

EXPORT Main_prog
Begin

Sub1
;

End;

Sub1
Begin

End

Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)