Re: Need help implementing a machine dependent function

Jon Leighton <[email protected]> Tue, 26 May 2009 17:05:09 -0400
Newsgroups gmane.comp.mozilla.devel.nspr
Message-ID <[email protected]>
Nelson Bolyard wrote:
> Jon Leighton wrote, On 2009-05-25 00:25 PDT:
> 
>> I tried to mimic this in Mac OS X with _PR_MD_SCTP_RECVMSG by adding the 
>> following
>>
>> in file primpl.h
>> extern PRInt32 _PR_MD_SCTP_RECVMSG(...);
>> #define  _PR_MD_SCTP_RECVMSG     _MD_SCTP_RECVMSG
> 
>> When I try to build I end up with a warning about an implicit definition 
>> of _PR_MD_SCTP_RECVMSG in ptio.c (where I call the function), and the 
>> build fails on nspr.dylib stating that _PR_MD_SCTP_RECV is an undefined 
>> symbol.  I can include the compiler output if that would be helpful.
> 
> The obvious implication of that warning/error is that one of the following
> is true:
> 1) ptio.c did not include primpl.h or
> 2) the lines you added to primpl.h were inside a #if that was false, or

Thank you!  This was exactly the problem.  I had mistakenly interpreted

#else /* defined(_PR_PTHREADS) */

to indicate the beginning of the _PR_PTHREADS=1 block, rather than the 
end of that block.  The code compiles and runs as expected now.

> 3) the copy of primpl.h that the compiler used did not contain your changes.
> 
> Did you do a full rebuild of NSPR after making your changes?
> I'd suggest you start by doing a full rebuild.
> Go into mozilla/nsprpub and find the directory in there that is created
> by the build (name ends in .OBJ) and rm -rf it.  Then rebuild.

I'm curious about the .OBJ files.  I couldn't find either .OBJ or .obj 
files anywhere in my builds for Darwin, FreeBSD, Solaris or Linux, 
though I did find some objs.mk files.  Are the .OBJ files generated on 
all platforms?

> 
> If that doesn't fix it, then the next step is to look at the output of
> the c pre-processor for ptio.c, and look for your changes.  You won't see
> the #defines, but you should see your other additions.  If you don't then
> you need to figure out why.  The answer is likely #if or #ifdef.
>