<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote cite="mid:4D2D4CD2.70609@kmiac.ru" type="cite">
<blockquote type="cite">
<blockquote type="cite">b) What happen if NoHandler is not
found?
<br>
</blockquote>
Then TestProc cannot be resolved to any symbol, and will
generate a weak
<br>
undefined reference. Eg. it won't complain about an undefined
reference
<br>
</blockquote>
<br>
I don't see where you reference the "weakinitial" symbol in your
patch that's why I'm asking this question. If NoHandler is not
referenced it will be stripped away during the linking process?
<br>
<br>
Generally I want to have an ability to handle a case where I call
an unresolved symbol but I want to be sure that I receive
arguments and my handler will not be striped from the executable.
<br>
<br>
I'd better suggest the next syntax:
<br>
<br>
procedure NoHandler;
<br>
begin
<br>
end;
<br>
<br>
procedure TestProc; weakexternal name 'TestProc' set NoHandler;
<br>
<br>
In this case I'm sure that:
<br>
1. NoHandler is a valid identifier which points to a procedure.
<br>
2. I can check that NoHandler has compatible with TestProc
definition.
<br>
3. I can reference NoHandler so it will not be removed away from
the executable.
<br>
<br>
Although I may be just don't understand your proposal.
<br>
<br>
Best regards,
<br>
Paul Ishenin
<br>
</blockquote>
Very good idea. It would make alot of sense to do that<br>
<br>
Regarding referencing to prevent removal:<br>
weakinitial is referenced through the .set directive here <br>
<tt>AsmWriteLn('.set'#9+tasmsymbol(current_asmdata.AsmSymbolDict[i]).Name+','+tasmsymbol(current_asmdata.AsmSymbolDict[i]).weakinitial.Name)<br>
<br>
</tt>This explicitly tells the linker that either the label TestProc
has the value weakinitial.name; or if the label TestProc is defined
somewhere else take on that value. If<tt><span
class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; font-size: medium;"></span></tt>
TestProc exists then there would be no need for NoHandler, so it
would be fine if it was stripped from the executable. If neither
isn't there we would have a problem of course, which your idea would
solve<br>
</body>
</html>