Article View: comp.sys.next.programmer
Article #810Re: PLEASE help me with rld! PLEASE! PLEASE! PLEASE! PLEASE! PLEASE!
From: Greg Burd (Temp)
Date: Mon, 24 Aug 1992 19:19
Date: Mon, 24 Aug 1992 19:19
71 lines
2394 bytes
2394 bytes
In article <HRA6NUH@mailgzrz.tu-berlin.de> mauriti@cs.tu-berlin.de (Frank
Hartlep) writes:
> I've asked this already and nobody replied. But I can't believe there's
> nobody on this big, big net who knows how to use rld.
>
> Take a look at this code ...
[[ deleted code ]]
>.... and PLEASE! PLEASE! PLEASE! PLEASE! tell me what's wrong with it.
> Loader should load to_be_loaded.o and execute LoadedFunction.
> Sounds easy, but why does it fail in rld_load_basefile (with a
> floating point exception in NXCreateZone, as the debugger tells me)???
>
> ANY info is welcome !
>
> Thanks,
> Frank
---------------
Hello Frank,
Here is a little goof off program where rld is used. TestRLD and
toLoad.c should be in the same dir. What happens is that TestRLD compiles
and then loads toLoad.c, and then it calls the funct myprintf() to verify
the load succeded. Cut and paste the two files and then compile and run
TestRLD, and enjoy.
Greg Burd
NeXT Developer Support Team
#import <std/disclaimer>
#import <std/joke>
:-)
----------------TestRLD.c------------------
#include <stdio.h>
#include <rld.h>
#include <sys/stat.h>
#include <sys/file.h>
main()
{
struct mach_header **addr;
unsigned long value = 0x0;
void (*myprint)();
char *files[] = {"toLoad",NULL};
system("cc -c -O -o toLoad toLoad.c");
if (rld_load(NULL,addr,files,NULL)) {
printf("I have loaded files\n");
if(rld_lookup(NULL,"_myprint",&value))
fprintf(stderr, "Lookup success\n");
else fprintf(stderr, "Lookup failure\n");
myprint=(void *) value;
printf("I have looked up value = %d\n",value);
(*myprint)();
}
}
-------------------------------------------
----------------TestRLD.c------------------
#include <stdio.h>
myprint()
{
printf("I have been called\n");
}
-------------------------------------------
Technical Details
Message-ID:
<4828@rosie.NeXT.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!iggy.GW.Vitalink.COM!nocsun.NOC.Vitalink.COM!wetware!ditka!ntg!rosie!trouble.next.comReferences:
<HRA6NUH@mailgzrz.tu-berlin.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!iggy.GW.Vitalink.COM!nocsun.NOC.Vitalink.COM!wetware!ditka!ntg!rosie!trouble.next.com From: gburd@trouble.next.com (Greg Burd (Temp)) Newsgroups: comp.sys.next.programmer Subject: Re: PLEASE help me with rld! PLEASE! PLEASE! PLEASE! PLEASE! PLEASE! Message-ID: <4828@rosie.NeXT.COM> Date: 24 Aug 92 19:19:22 GMT References: <HRA6NUH@mailgzrz.tu-berlin.de> Sender: news@NeXT.COM Lines: 71