Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 1998 15:10:48 -0500
From:      Jacques Vidrine <n@nectar.com>
To:        zhihuizhang <bf20761@binghamton.edu>
Cc:        hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: linker set defintion (ls_item) 
Message-ID:  <199806132010.PAA20988@bone.nectar.com>
In-Reply-To: <Pine.SOL.L3.93.980613155010.26627A-100000@bingsun1> 
References:  <Pine.SOL.L3.93.980613155010.26627A-100000@bingsun1>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----

One definition results in the list of void* immediately following
the structure, i.e.

+------------------+
| int ls_length    |
+- - - - - - - - - +
| void* ls_item[0] |--->
+- - - - - - - - - +
| void* ls_item[1] |--->
+- - - - - - - - - +
| etc....          |


The other definition results in the list void* being somewhere
unknown.

+------------------+
| int ls_length    |
+- - - - - - - - - +     +------------------+
| void** ls_item   |---> | void* ls_item[0] |--->
+------------------+     +- - - - - - - - - +
                         | void* ls_item[1] |--->
                         +- - - - - - - - - +
                         | etc....          |


Hope this helps,

Jacques Vidrine <n@nectar.com> 

On 13 June 1998 at 15:56, zhihuizhang <bf20761@binghamton.edu> wrote:
> 
> I am reading freeBSD source code concerning the linker set which I believe
> is a set of *addresses* of similar symbols.  The linker set structure is
> defined in kernel.h as: 
> 
> 	struct linker_set {
> 		int	ls_length;
> 		const void * ls_item[1];
> 	}
> 
> The value of ls_item should be the address of an array of pointers.  Since
> the size of this array is not fixed, I wonder why it is not defined as: 
> 
> 	struct linker_set [
> 		int	ls_length;
> 		const void ** ls_item;
> 	}
> 
> This may have something to do with the C compiler.  I hope some C expert
> can give me a hint.  Thanks in advance.
> 
> -------------------------------------------------
> 
> Zhihui Zhang
> 
> Department of Computer Science
> State University of New York at Binghamton
> 
> Web Site: http://cs.binghamton.edu/~zzhang
> 
> -------------------------------------------------
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 



-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBNYLcyDeRhT8JRySpAQFu/wP+MymEvMbjsb4nnxTSPwSMKetKcqMye1BU
u2XNGzPxjLdynreye+3h7Ob06UZGa+h0hURBgWd5c1pbVwqyUcQGC+K0B40mPzwh
cwSbpFfn/SEjjhZ5Vs8C8W8msy4mkaF1h1zaYtJxRT/2gRDAFpxUJRwYZ0JOxxLe
OmaJ3Hc5Lqg=
=R3eV
-----END PGP SIGNATURE-----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806132010.PAA20988>