Related articles |
---|
Fetch function names & prototypes? codefixer@gmail.com (2005-10-17) |
Re: Fetch function names & prototypes? touati@prism.uvsq.fr (TOUATI Sid) (2005-10-19) |
From: | TOUATI Sid <touati@prism.uvsq.fr> |
Newsgroups: | comp.compilers |
Date: | 19 Oct 2005 02:37:10 -0400 |
Organization: | Universite de Versailles Saint-Quentin-en-Yvelines |
References: | 05-10-103 |
Keywords: | linker, types |
Posted-Date: | 19 Oct 2005 02:37:10 EDT |
> Thanks.
> [Of course it's possible to construct a symbol table of functions,
> although in C++ the prototypes are found in the header files included
> by each module so there's no need. There's also an old trick: encode
> the argument types of each function as a byte string, put the byte
> string into the object file symbol table, and have the linker compare
> those byte strings and complain if they don't match. The linker doesn't
> have to understand the types, just see if they match. -John]
>
John,
The question is how do you encode the types. My intuition is that this
trick would not allow a perfect/accurate type checking. If types are
simple (say scalars), this trick would work. But if the function
arguments have complex data types, this would produce wrong type
mismatches.
S
[It's basically the same trick as C++ name mangling, represent the type
as a coded token string. If it's a complex type, the string may get long
but that's not a problem. I first saw this in the Dartmouth PL/I compiler
circa 1976, and it worked well. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.