[alt.msdos.programmer] __acrtused

venkat@matrix.UUCP (D Venkatrangan) (06/03/90)

The assembly listing from a MS-C compiler shows a 'EXTRN __acrtused ABS' entry.
If these objects are linked in without the crt0.obj from the library, this
symbol ends up being undefined.

What specific role does the __acrtused variable perform during linking/loading
and during program execution.  If I choose to define this public, what should
it be initialized to?

thanks
-----

cb@sequoia.execu.com (Christopher D. Brown) (06/03/90)

In article <139@matrix.UUCP> venkat@matrix.UUCP (D Venkatrangan) writes:
...
>What specific role does the __acrtused variable perform during linking/loading
>and during program execution.  If I choose to define this public, what should
>it be initialized to?
__acrtused is used solely to cause crt0 (the runtime start up code) to be
loaded from the runtime library during linking.  If you wish to suppress
this load, then define __acrtused any way you wish.  Watch out for other
runtime library members which use other entries in the runtime code.


Christopher D. Brown

Digital: {uunet|texbell|cs.utexas.edu}!execu!cb
Analog: (512) 327-7070
Physical: Execucom, 108 Wild Basin Road, Two Wild Basin, Austin, TX 78764
-- 
Christopher D. Brown

Digital: {uunet|texbell|cs.utexas.edu}!execu!cb
Analog: (512) 327-7070
Physical: Execucom, 108 Wild Basin Road, Two Wild Basin, Austin, TX 78764

P88035@BARILVM.BITNET (Ephraim Vider) (06/03/90)

In article <139@matrix.UUCP>, venkat@matrix.UUCP (D Venkatrangan) says:
>
>The assembly listing from a MS-C compiler shows a 'EXTRN __acrtused ABS'
>entry.
>If these objects are linked in without the crt0.obj from the library, this
>symbol ends up being undefined.
>
>What specific role does the __acrtused variable perform during linking/loading
>and during program execution.  If I choose to define this public, what should
>it be initialized to?
>


The purpose of this 'variable' is exactly that - to force the linker
to link in crt0.obj from the xLIBCy.LIB library. This allows you
to specify your objects only and not to be conerned with the startup
code.

As this symbol is declared  'ABS' it means it was defined something
like this:

     PUBLIC  __acrtused
__acrtused   EQU  0          ; the value is not important

N.B:
Using MSC objects or libraries with another C compiler is something
I didn't try, but I suppose you'll have to also write your own
__chkstk (local variable allocator). And even then some library
functions might not work without the startup code.

     Hope this helps
           Ephraim

( no signature yet :-|)

bright@Data-IO.COM (Walter Bright) (06/05/90)

In article <139@matrix.UUCP> venkat@matrix.UUCP (D Venkatrangan) writes:
<The assembly listing from a MS-C compiler shows a 'EXTRN __acrtused ABS' entry.
<If these objects are linked in without the crt0.obj from the library, this
<symbol ends up being undefined.
<What specific role does the __acrtused variable perform during linking/loading
<and during program execution.

It causes the startup code to be pulled in from the library to satisfy
the reference.

<If I choose to define this public, what should
<it be initialized to?

It doesn't matter. But you'll have to supply your own startup code.