Well, I've finally gotten the answer I was looking for by crawling the
web some more. Here's what I've learned, in case someone else could
use this insight.
1. global.asa doesn't recognize <% and %> tags.
2. INCLUDE directives are HTML comments. So ASP has to be in HTML
parsing mode at the point where the include directive HTML comment
begins.
3. The parsing of ASP pages, including global.asa, starts out in HTML
mode, so you need <% (or <script> for global.asa) before code, and %>
(or </script> in global.asa) to get back to HTML parsing mode.
4. Subroutines at the beginning of global.asa are not handled
properly, so put them at the end.
5. option explicit comes before all code, including include files; if
used, include files must obey the explicit rule too; option explicit
can only be specified once, so don't put it in your include files
Here's what now works for me:
afunc.inc
---------
<%
function testit(b)
dim avar
avar = 1
testit = b + avar
end function
%>
apage.asp
---------
<% option explicit %>
<!-- #INCLUDE FILE="afunc.inc" -->
<%
dim t
( asp code )
t = testit(4)
%>
global.asa
----------
<script language="VBScript" runat="server">
option explicit
sub Application_OnStart
(VBscript)
end sub
sub Application_OnEnd
(VBscript)
end sub
sub Session_OnStart
(VBscript)
end sub
sub Session_OnEnd
dim what
(VBscript)
what = testit(11)
end sub
</script>
<!-- #INCLUDE FILE="afunc.inc" -->