On 10/06/2015 15:18, Joe Taylor wrote:
> Hi Bill,
Hi Joe & Steve,
>
> On 6/10/2015 10:03 AM, Bill Somerville wrote:
>> Hi again,
>>
>> further update - looks like the C function nhash_() is receiving args by
>> value but is called from Fortran which passes by reference.
> You're exactly right.  Compare the nhash.c that's now in the wsjtx
> branch with the one in the wspr branch.  Their interfaces look like this:
>
> wsjtx development branch:
>
> uint32_t nhash_( const void *key, size_t length, uint32_t initval)
>
> wspr branch:
>
> uint32_t nhash_( const void *key, int *length0, uint32_t *initval0)
>
> This function is called from both Fortran and C; we much change the
> calls from C so that they use the call-by-reference form for all three
> arguments.
RRR but I prefer a simple wrapper that converts the arguments. I will 
post shortly, just testing my other change for the < and > characters.

Actually my real preference is that Fortran routines that interoperate 
with C routines should declare an interface that sets the name binding a 
"C" and it can also declare dummy arguments as passed by VALUE if 
desired. Such procedures can still be called from Fortran seamlessly.

Likewise Fortran routines that need to call C routines should declare an 
interface for the C routine, same as above applies. Not quite as neat as 
including a C header file although there may well tools around that 
automatically generate interface blocks from C headers.

All so much easier that dealing with different calling conventions and 
symbol name mangling.
>
>       -- Joe
73
Bill
G4WJS.

------------------------------------------------------------------------------
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to