Need help implementing a machine dependent function

Jonathan Leighton <[email protected]> Thu, 21 May 2009 01:17:10 -0400
Newsgroups gmane.comp.mozilla.devel.nspr
Message-ID <[email protected]>
I'm trying to add a machine dependent function to NSPR, but I'm having 
some trouble understanding how the existing code translates from a 
function like _PR_MD_FUNCTION() to the platform specific function 
_MD_function().  In my case I'm using a function called 
_PR_MD_SCTP_RECVMSG() in pr/src/pthreads/ptio.c and I want that to 
translate to different MD_sctp_recvmsg() functions defined in the 
various pr/src/md files.  For example, on Solaris I'd expect 
_PR_MD_SCTP_RECVMSG() to use the _MD_sctp_recvmsg() that I've added to 
pr/src/md/unix/solaris.c.

I've tried to mimic the existing approach using several #define's and 
extern function prototypes in various files, but I haven't been able to 
make it work.  As a fallback, I've simply specified an extern function 
prototype for _PR_MD_SCTP_RECVMSG() in pr/include/private/primpl.h and 
then defined _PR_MD_SCTP_RECVMSG() as extern in the various pr/src/md 
files such as solaris.c.  This works but it doesn't seem like the 
"right" way to do it.  I'd be grateful for any help explaining how to do 
this correctly.  Thanks very much.

- Jon