csran@warwick.ac.uk (Mr S J Russell) (11/12/90)
Hi each and everyone, I have a problem, but enough about my private life, no seriously I do. It's called MSC 4.0. I have a small chunk of assembly in a file that handles startup and initialization. I assemble this and everything is great. I would like to link to this a .obj file containing a few functions written in C. The problem is this. I don't want to include any library functions so I use /NOD at link time. However the linker generates the following error Unresolved externals: fred.obj(fred.c) __acrtused Does anybody know what __acrtused is or does. Is it used. I cannot find reference to it in an ordinary C programme that has been compiled and linked. Codeview seems to know about it because it returns its value/address without any problems. The startup code doesn't seem to use it and I certainly don't. Where does it come from. By the way I've tried compiling with the /Zl flag. If anyone can shed a spot of light on the subject I would very much appreciate it. Yours desperately needing a newer compiler/linker, Stu (sjr@uk.ac.warwick.cs) Please use sjr@uk.ac.warwick.cs for any email
huehn@geac.com (Robert Huehn) (11/14/90)
In article <1990Nov12.154215.21018@warwick.ac.uk> csran@warwick.ac.uk (Mr S J Russell) writes: >called MSC 4.0. I have a small chunk of assembly in a file that handles >startup and initialization. I assemble this and everything is great. >I would like to link to this a .obj file containing a few functions written in >C. The problem is this. I don't want to include any library functions so I use >/NOD at link time. However the linker generates the following error > >Unresolved externals: > >fred.obj(fred.c) > __acrtused > >Does anybody know what __acrtused is or does. Is it used. I cannot find >reference to it in an ordinary C programme that has been compiled and linked. >Codeview seems to know about it because it returns its value/address >without any problems. The startup code doesn't seem to use it and I >certainly don't. Where does it come from. By the way I've tried compiling with >the /Zl flag. >> Stu (sjr@uk.ac.warwick.cs) I've ran into this too, with MSC 5.1. It's a little annoying. If you take a look at the assembly file MSC generates, the first line in the externals list is: EXTRN __acrtused :ABS It isn't used in the rest of the listing either. So it seems that you could safely give the linker a bogus reference in your assembly code. It works for me. -- Rob Huehn (huehn@geac.com) 2B Computer Engineering, University of Waterloo
Ralf.Brown@B.GP.CS.CMU.EDU (11/14/90)
In article <1990Nov13.164250.19569@geac.com>, huehn@geac.com (Robert Huehn) wrote: }I've ran into this too, with MSC 5.1. It's a little annoying. If you take }a look at the assembly file MSC generates, the first line in the externals }list is: } }EXTRN __acrtused :ABS } }It isn't used in the rest of the listing either. So it seems that you could }safely give the linker a bogus reference in your assembly code. It works }for me. My understanding is that the only thing this symbol does is force the C startup code to be pulled in from the library. Turbo C requires that the startup module be given explicitly on the linker command line, while MSC includes the startup module in the library. -- UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask ARPA: ralf@cs.cmu.edu BIT: ralf%cs.cmu.edu@CMUCCVMA FIDO: 1:129/3.1 Disclaimer? | I was gratified to be able to answer promptly, and I did. What's that? | I said I didn't know. --Mark Twain
lsalomo@hubcap.clemson.edu (lsalomo) (11/14/90)
acrtused is used to link in the startup code, where it is defined. Note that if you do NOT link in the startup code, you must manually set DS to point to the proper place and do all kinds off other annoying things yourself! Also, note that the startup code is what gets called, and it calls main; main is NOT the entry-point of a compiled C program. Cheers, Q - the "Q"uestor for knowledge (, a degree, etc.) lsalomo@hubcap.clemson.edu ibmman@clemson.clemson.edu ============================================================================= "Gee Wally, I think there's something wrong with the Beaver." =============================================================================
kdq@demott.COM (Kevin D. Quitt) (11/15/90)
__acrtused is used to force the loading of the Microsoft startup code. Microsoft defines it as 9876h (if I recall correctly), with a note that this is a value that isn't otherwise likely to crop up in symdeb. Define it as anything you like, nobody references. You'll find it in CRT0.ASM. -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last 96.37% of all statistics are made up.
prk@planet.bt.co.uk (KnightRider) (11/16/90)
kdq@demott.COM (Kevin D. Quitt) writes:
__acrtused
My understanding is that this is used to indicate to the linker whether
or not to pull in the C run-time library.
The documentation for this is to be found in descriptions of how to build
dynamic link-libraries for OS/2.
However, I believe if you put this line in your program:
int _arcrtused =0;
Then the C run-time is EXCLUDED by the linker,
int _arcrtused =1;
INCLUDES the linker.
It may be plausible, though rash, to assume that a similar variable declaration
in an assembly program will cause the inclusion/exclusion of the C run-time
in an assembly program.
Of course, if you have a program partly build in C, then you may only exclude
the run-time library iff:
1 You provide your own entry point (ie no C main function)
2 You do not use the C run-time library (though yu can use macros,
of course).
Peter Knight
BT Research
#include <std.disclaimer>
jcmorris@mwunix.mitre.org (Joe Morris) (11/20/90)
prk@planet.bt.co.uk (KnightRider) writes: >kdq@demott.COM (Kevin D. Quitt) writes: >__acrtused >My understanding is that this is used to indicate to the linker whether >or not to pull in the C run-time library. >The documentation for this is to be found in descriptions of how to build >dynamic link-libraries for OS/2. You could also look at the assembly source code for the routine: it's part of the optional startup sources in the C distribution diskettes. Memory says it's in \c\source\dos. The attached comment is something along the order of "funny number to bring in startup code, not likely to be duplicated in SYMDEB". Joe Morris