gday@digigw.digital.co.jp (Gordon Day) (10/03/90)
I have been mixing assembly language and C routines successfully, but when setting up the runtime environment for C subroutines I have to define the symbol __acrtused in the DGROUP group to keep the linker happy. What is significance of this value? What should it be set to, or does it really matter? (My belief is that it is only of significance if the crt0.obj startup are being used, but in that case, why is it being defined public?) Gordon W. Day
risto@tuura.UUCP (Risto Lankinen) (10/04/90)
gday@digigw.digital.co.jp (Gordon Day) writes: >I have been mixing assembly language and C routines successfully, but when >setting up the runtime environment for C subroutines I have to define the >symbol __acrtused in the DGROUP group to keep the linker happy. What is >significance of this value? What should it be set to, or does it really >matter? (My belief is that it is only of significance if the crt0.obj startup >are being used, but in that case, why is it being defined public?) Hi! Suppose you made a C program which makes no calls to the C libraries. When you link such a program, the linker would not need to search the C run-time library file, and the program would lack the start address (defined in the CRT0.ASM of the C library) among other things. However, the presence of the C run-time initialization code is in many cases essential, and this is why the compiler makes an explicit reference to __acrtused (compile with '-Fa' to see yourself), to ensure that the C run-time start-up code will be linked to the application's .EXE . The __acrtused itself is a dummie, and it has been assigned an absolute value of 0x9876 (a 'rare' value as an address to anything in order not to confuse SYMDEB.EXE ). The assembly code needs to refer to the __acrtused only if it in turn refers to C run- time library functions either explicitly or implicitly via a (self-made) C function. Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************
bright@nazgul.UUCP (Walter Bright) (10/25/90)
In article <681@digigw.digital.co.jp> gday@digigw.digital.co.jp (Gordon Day) writes:
<I have been mixing assembly language and C routines successfully, but when
<setting up the runtime environment for C subroutines I have to define the
<symbol __acrtused in the DGROUP group to keep the linker happy. What is
<significance of this value? What should it be set to, or does it really
<matter? (My belief is that it is only of significance if the crt0.obj startup
<are being used, but in that case, why is it being defined public?)
A reference to __acrtused is inserted into every .OBJ file produced by
the C compiler (do a dump on the OBJ file and you'll see it). The purpose
is so that the linker will pull in the startup code, which is the only
module in the library which defines it. The value of __acrtused is irrelevant.