[MLton] bootstrap problem

Stephen Weeks MLton@mlton.org
Tue, 9 Aug 2005 14:07:36 -0700


> There were also a few warnings:
...
> ./platform.h:81:1: warning: "bool" redefined
> In file included from /usr/include/mach-o/dyld.h:35,
>                   from platform/darwin.c:1:
> /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/include/stdbool.h:36:1:  
> warning: this is the location of the previous definition

I wrapped the definition of bool in an #ifndef.  Hopefully that fixes
this.

> platform/darwin.c: In function 'getTextStart':
> platform/darwin.c:30: warning: passing argument 2 of  
> '_dyld_lookup_and_bind' from incompatible pointer type
> platform/darwin.c:30: warning: passing argument 3 of  
> '_dyld_lookup_and_bind' from incompatible pointer type
> platform/darwin.c:31: warning: passing argument 1 of  
> '_dyld_get_image_header_containing_address' makes pointer from  
> integer without a cast
> platform/darwin.c:31: warning: assignment discards qualifiers from  
> pointer target type

Hmm.  I don't get any warnings when compiling on my Darwin 7.0.0
machine with gcc 3.3.  Here what's in dyld.h.

--------------------------------------------------
extern void _dyld_lookup_and_bind(
    const char *symbol_name,
    unsigned long *address,
    void **module);

extern struct mach_header * _dyld_get_image_header(
    unsigned long image_index);
--------------------------------------------------

And here's the relevant part of darwin.c

--------------------------------------------------
void *getTextStart () {
	unsigned long address;
	void *module;
	struct mach_header *mh;

/*30*/	_dyld_lookup_and_bind ("_main", &address, &module);
/*31*/	mh = _dyld_get_image_header_containing_address (address);
--------------------------------------------------

All the types look OK to me.  What are the prototypes on your Darwin 8
machine?