Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Adding new functions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Adding new functions
Authored by: jschimpf on Aug 30, '01 12:45:41PM

This is simple and not-so-simple. First you don't want to mess with any system stuff so all you have to do is add two more files my_rand.c and my_rand.h to the files that you are compiling. Then (here is the not-so-simple part) you have to write srand48 and drand48 (or steal the source from somewhere) and put that c source in the .c file. Then put the function definitions into my_rand.h.
Now all you have to do is put #include "my_srand.h" into each of the files that call these functions and "volia !" your code will link to these and run. This is exactly how stdlib and strings work except Apple in this case has compiled it for you before you compile your code. In this case you just compile these "missing" functions in with your code. If you have any more questions send me email.



[ Reply to This | # ]