What is the use of dynload?

57 views
Skip to first unread message

gmhwxi

unread,
Nov 21, 2013, 4:47:02 PM11/21/13
to ats-lan...@googlegroups.com

The sole purpose of dynload is for doing initialization.

Say in a file named 'foo.dats', we have the following line:

dynload "bar.dats"

This line gets compiled to a call to the initialization function
associated with 'bar.dats'. Without this line, a link-time error message
of the form "..._dynload_flag is undefined" is to be reported.

If you don't want the initialization function for 'bar.dats' to be
called, then please add the following line in 'bar.dats':

#define ATS_DYNLOADFLAG 0

Please do this with caution.

Normally, 'dynload' lines should only occur in the file that contains the
implementation of the 'main' function.

Brandon Barker

unread,
Jan 19, 2014, 4:39:42 PM1/19/14
to ats-lan...@googlegroups.com
Are there any examples or conventions related to naming initialization functions? I see plenty of .dats files without 

#define ATS_DYNLOADFLAG 0


but nothing necessarily stood out as an initialization function.

gmhwxi

unread,
Jan 19, 2014, 5:08:04 PM1/19/14
to ats-lan...@googlegroups.com

The initialization functions are named internally and calls to these functions
are inserted by the compiler automatically.
Reply all
Reply to author
Forward
0 new messages