[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2143.0. "nolinkage between rpc.h and ints.h" by CSC32::J_HENSON (Don't get even, get ahead!) Tue Apr 08 1997 11:04

DEC C V5.5-002, UCX V4.1 ECO 4, OpenVMS V6.2/7.1, Alpha

I have another one of those pesky %CC-E-NOLINKAGE problems between a
UCX include and a C include.  This time, the typdefs in question are
int32, uint32, int64 and uint64.  The clashing includes are
rpc.h and ints.h.  See the code listed below for a reproducer.

FWIW, the customer reporting this was not explicitly including ints.h.
He included pthread.h, which brought in ints.h.

Also, I'll cross post in the UCX notes conference.

And, last but not least, I don't see a workaround for this.  From looking
at the .lis file, it appears that rpc.h defines these typedefs regardless.
Ints.h only checks that either __DECC or __DECCXX and __ALPHA is defined,
so compiling with /define=_DECC_V4_SOURCE or /define=_VMS_V6_SOURCE
has no effect.

This is probably a show stopper for my customer, and I expect that he
will be pushing hard for a solution.

Thanks,

Jerry


====================================================================

$create tstrpc.c
#include <rpc/rpc.h>
#include <ints.h>
main()
{	
	exit(0);
}
$define rpc ucx$rpc
$cc/list/show=all tstrpc
T.RTitleUserPersonal
Name
DateLines
2143.1Make ints.h think it's already been includedWIBBIN::NOYCEPulling weeds, pickin&#039; stonesTue Apr 08 1997 11:297
Well, you could hack around it by inserting

#define __INTS_LOADED 1

before the include of pthread.h.  If rpc.h left
out some of the ints that pthread.h needs, you would
have to define them yourself.
2143.2thanksCSC32::J_HENSONDon&#039;t get even, get ahead!Wed Apr 09 1997 10:2919
>>      <<< Note 2143.1 by WIBBIN::NOYCE "Pulling weeds, pickin' stones" >>>
>>               -< Make ints.h think it's already been included >-

>>Well, you could hack around it by inserting

>>#define __INTS_LOADED 1

>>before the include of pthread.h.  If rpc.h left
>>out some of the ints that pthread.h needs, you would
>>have to define them yourself.

I tried this.  With just rpc/rpc.h and phtread.h included, inserting
__INTS_LOADED 1 before the include of pthread fixed the problem.  I
don't know if this same approach might cause other problems in other
situations, though.

Thanks,

Jerry
2143.3Will look furtherTLE::D_SMITHDuane Smith -- DEC C RTLWed Apr 09 1997 10:4119
    We've seen this type of problem before, but I cannot find it for the
    life of me.  I'll ask a former team member to dig into her memory banks
    for this.
    
    In my opinion, this is one of the weakest areas of the C language. 
    Prior to creating a new typedef, there is no way to determine if it is
    already defined or not.  There is also no way to redefine the typedef
    even if it is exactly the same.  Convention is leading us to using a
    macro indicating that a typedef has already been done.  
    
      #ifndef __SIZE_T
      #   define __SIZE_T 1
          typedef unsigned int size_t;
      #endif

    This strategy is fine when you own all the header files, but in the
    RPC.H case, we do not.
    
    Duane
2143.4CSC32::J_HENSONDon&#039;t get even, get ahead!Wed Apr 09 1997 12:537
>>         <<< Note 2143.3 by TLE::D_SMITH "Duane Smith -- DEC C RTL" >>>
>>                             -< Will look further >-

I will be IPMT'ing this against UCX.  I think it's an issue that will have
to resolved by ucx.

Jerry
2143.5SPECXN::DERAMODan D&#039;EramoWed Apr 09 1997 13:4420
>      #ifndef __SIZE_T
>      #   define __SIZE_T 1
>          typedef unsigned int size_t;
>      #endif
>
>    This strategy is fine when you own all the header files, but in the
>    RPC.H case, we do not.
    
        You can handle more cases with a little builtin compiler
        support:
        
		__typedef unsigned int size_t;
        
        or
        
        	#pragma typedef unsigned int size_t;
        
        :-)
        
        Dan