Mail Archives: djgpp/1996/07/31/14:46:33
tob AT world DOT std DOT com (Tom Breton) wrote:
>If I understand right, the linking part of what you suggest should
>not only be possible but easy,
Exactly!
>since constructors and destructors are
>already handled similarly. They put pointers to themselves in special
>sections (.ctor, .dtor), which djgpp.lnk and some code in crt0 handle
>specially. ".lock" would want entire functions and every variable they
>touched.
Yes, you'd need to manually check which variables and other functions
your function touched, but the act of marking them for locking would
be trivial, no need to go somewhere else in your source to put int
"_go32_dpmi_...". Just use two #defines:
#define LOCKED_VAR section (".lock"), nocommon
#define LOCKED_FUNC section (".lock")
int hello __attribute__ ((LOCKED_VAR));
void my_int() __attribute__ ((LOCKED_FUNC)) {
hello = 1;
}
I would make #defines for the whole __attribute__ ((xx)), but the
above usage is kinda consistent with the other attribute types.
The "nocommon" on variables stops them going into the common segment
if they're not initialised.
> Tom
Does anybody know why section("") doesn't work???
Regards,
ABW
--
I have become... Comfortably numb...
Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.hardcafe.co.uk/Alaric/">http://www.hardcafe.co.uk/Alaric/</A>
- Raw text -