--- a/hdf/src/hconv.h	2023-06-14 12:18:55.811618428 +0800
+++ b/hdf/src/hconv.h	2023-06-14 13:06:48.836772758 +0800
@@ -59,7 +59,7 @@
 /* CONSTANT DEFINITIONS                                                      */
 /*****************************************************************************/
 /* Generally Big-Endian machines */
-#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__) && !defined(__LITTLE_ENDIAN__) && !defined(__loongarch64)
+#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__) && !defined(__LITTLE_ENDIAN__) && !defined(__loongarch64) && !defined(__riscv)
 #       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
 #       define UI8_OUT    DFKnb1b
 #       define SI16_IN    DFKnb2b   /* S = Signed */
--- a/hdf/src/hdfi.h	2023-06-14 12:18:55.811618428 +0800
+++ b/hdf/src/hdfi.h	2023-06-14 13:08:14.042840915 +0800
@@ -82,6 +82,7 @@
 #define     DFMT_LINUXARM       0x4441
 #define     DFMT_LINUXAARCH64   0x4441
 #define     DFMT_LINUXLOONGARCH64   0x4441
+#define     DFMT_RISCV64        0x4441
 
 /* I/O library constants */
 #define UNIXUNBUFIO 1
@@ -1483,6 +1484,58 @@
 #endif
 #endif /* Linux LoongArch64 */
 
+#if defined (__linux__) && defined (__riscv) && (__riscv_xlen == 64)
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE 1
+
+#include <fcntl.h>
+#include <sys/types.h>      /* for unbuffered file I/O */
+#include <sys/stat.h>
+#include <unistd.h>
+#include <ctype.h>          /* for character macros */
+
+#define DF_MT             DFMT_RISCV64
+
+typedef void              VOID;
+typedef void *            VOIDP;
+typedef char *            _fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef signed char       int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef int               int32;
+typedef unsigned int      uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+#ifndef BIG_LONGS
+#define BIG_LONGS
+#endif
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/riscv64 */
+
 #ifndef GOT_MACHINE
 No machine type has been defined.  Your Makefile needs to have someing like
 -DSUN or -DUNICOS in order for the HDF internal structures to be defined
diff --text --unified a/mfhdf/ncgen/ncgen.l b/mfhdf/ncgen/ncgen.l
--- a/mfhdf/ncgen/ncgen.l	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/ncgen/ncgen.l	2023-06-14 13:09:07.439129345 +0800
@@ -113,7 +113,7 @@
 		    yyerror(errstr);
 		}
 
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 		if (dd < INT_MIN  ||  dd > INT_MAX) 
 #else
 		if (dd < LONG_MIN  ||  dd > LONG_MAX) 
diff --text --unified a/mfhdf/ncgen/ncgenyy.c b/mfhdf/ncgen/ncgenyy.c
--- a/mfhdf/ncgen/ncgenyy.c	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/ncgen/ncgenyy.c	2023-06-14 13:10:07.015371441 +0800
@@ -989,7 +989,7 @@
 		    yyerror(errstr);
 		}
 
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || __s390x__ || __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || __s390x__ || __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 		if (dd < INT_MIN  ||  dd > INT_MAX) 
 #else
 		if (dd < LONG_MIN  ||  dd > LONG_MAX) 
共同的子目录：a/mfhdf/fortran/examples 和 b/mfhdf/fortran/examples
diff --text --unified a/mfhdf/fortran/jackets.c.in b/mfhdf/fortran/jackets.c.in
--- a/mfhdf/fortran/jackets.c.in	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/fortran/jackets.c.in	2023-06-14 13:12:37.440955977 +0800
@@ -34,7 +34,7 @@
 
 struct ncfils {			/* This will be a common block from Fortran */
     double dd;
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
     int ll;
 #else
     long ll;
@@ -65,7 +65,7 @@
 
 struct ncfils {			/* This will be a common block from Fortran */
     double dd;
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
     int ll;
 #else
     long ll;
@@ -420,7 +420,7 @@
 }
 #endif /* FORTRAN_HAS_NO_SHORT */
 
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 /*
  * Convert multi-dimensional array of NCLONGs stored in ints to packed
  * array of longs, in malloc'ed space.  Returns pointer to longs or NULL
@@ -908,7 +908,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long          longs = *(int *)value;
@@ -1022,7 +1022,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long *longs = itol (value, ncount, ndims);
@@ -1133,7 +1133,7 @@
 	tmpbasis	= nctypelen(NC_LONG);
     else
 #endif
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
     if (datatype == NC_LONG)
 	tmpbasis	= sizeof(int);
     else
@@ -1190,7 +1190,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long *longs = itolg (value, ncount, nbasis, ndims);
@@ -1326,7 +1326,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long          longs;
@@ -1468,7 +1468,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
@@ -1606,7 +1606,7 @@
 	tmpbasis	= nctypelen(NC_LONG);
     else
 #endif
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
     if (datatype == NC_LONG)
 	tmpbasis	= sizeof(int);
     else
@@ -1677,7 +1677,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
@@ -1843,7 +1843,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) *datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 	long *longs = itol (value, attlen, 1);
@@ -2008,7 +2008,7 @@
 	return;
     }				/* else */
 #endif				/* FORTRAN_HAS_NO_SHORT */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 #ifdef HDF
     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
 /* EIP  We need to use int buffer to read data in on the platforms where long is 8 bytes
diff --text --unified a/mfhdf/libsrc/array.c b/mfhdf/libsrc/array.c
--- a/mfhdf/libsrc/array.c	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/libsrc/array.c	2023-06-14 13:13:05.924083029 +0800
@@ -625,7 +625,7 @@
 		xdr_NC_fnct = xdr_shorts ;
 		goto func ;
 	case NC_LONG :
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 		xdr_NC_fnct = xdr_int ;
 #else
 		xdr_NC_fnct = xdr_long ;
diff --text --unified a/mfhdf/libsrc/cdf.c b/mfhdf/libsrc/cdf.c
--- a/mfhdf/libsrc/cdf.c	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/libsrc/cdf.c	2023-06-14 13:13:28.280587523 +0800
@@ -3686,7 +3686,7 @@
         break ;
     case NC_LONG :
         alen /= 4 ;
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loontarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loontarch64 || (defined __riscv && __riscv_xlen == 64)
         xdr_NC_fnct = xdr_int ;
 #else
         xdr_NC_fnct = xdr_long ;
diff --text --unified a/mfhdf/libsrc/netcdf.h.in b/mfhdf/libsrc/netcdf.h.in
--- a/mfhdf/libsrc/netcdf.h.in	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/libsrc/netcdf.h.in	2023-06-14 13:13:43.177145992 +0800
@@ -293,7 +293,7 @@
 /* 
  * Variables/attributes of type NC_LONG should use the C type 'nclong'
  */
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 /*
  * LP64 (also known as 4/8/8) denotes long and pointer as 64 bit types.
  * http://www.unix.org/version2/whatsnew/lp64_wp.html
diff --text --unified a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c
--- a/mfhdf/libsrc/putget.c	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/libsrc/putget.c	2023-06-14 13:16:35.645886924 +0800
@@ -664,7 +664,7 @@
 	case NC_SHORT :
 		return( xdr_NCvshort(xdrs, (unsigned)rem/2, (short *)values) ) ;
 	case NC_LONG :
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 		return( xdr_int(xdrs, (nclong *)values) ) ;
 #else
 		return( xdr_long(xdrs, (nclong *)values) ) ;
@@ -1975,7 +1975,7 @@
 		} /* else */
 		return(TRUE) ;
 	case NC_LONG :
-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 		xdr_NC_fnct = xdr_int ;
 #else
 		xdr_NC_fnct = xdr_long ;
diff --text --unified a/mfhdf/libsrc/xdrposix.c b/mfhdf/libsrc/xdrposix.c
--- a/mfhdf/libsrc/xdrposix.c	2023-06-14 12:18:55.811618428 +0800
+++ b/mfhdf/libsrc/xdrposix.c	2023-06-14 13:18:44.928270056 +0800
@@ -254,7 +254,7 @@
 
 static bool_t   xdrposix_getlong();
 static bool_t   xdrposix_putlong();
-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 static bool_t   xdrposix_getint();
 static bool_t   xdrposix_putint();
 #endif
@@ -268,7 +268,7 @@
 #if (defined __sun && defined _LP64)
 static rpc_inline_t *    xdrposix_inline();
 #else
-#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__ || defined __aarch64__  || defined __loongarch64
+#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__ || defined __aarch64__  || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 static int32_t *    xdrposix_inline();
 #else
 #if (defined __alpha )
@@ -298,9 +298,9 @@
     xdrposix_getpos,    /* get offset in the stream */
     xdrposix_setpos,    /* set offset in the stream */
     xdrposix_inline,    /* prime stream for inline macros */
-#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
     xdrposix_destroy,   /* destroy stream */
-#if !(defined __aarch64__) && !(defined __s390x__) && !(defined __x86_64__) && !(defined __powerpc64__) || (defined  __sun && defined _LP64) || (!defined __loongarch64)/* i.e. we are on SUN/Intel in 64-bit mode */
+#if !(defined __aarch64__) && !(defined __riscv && __riscv_xlen == 64) && !(defined __s390x__) && !(defined __x86_64__) && !(defined __powerpc64__) || (defined  __sun && defined _LP64) || (!defined __loongarch64)/* i.e. we are on SUN/Intel in 64-bit mode */
     NULL,               /* no xdr_control function defined */
 #endif 
     /* Solaris 64-bit (arch=v9 and arch=amd64) has 64 bits long and 32 bits int. */
@@ -556,7 +556,7 @@
 #if (defined  __alpha)
 static int* 
 #else
-#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 static int32_t * 
 #else
 static netlong * 
@@ -584,7 +584,7 @@
     return (NULL);
 }
 
-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64
+#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__ || defined __loongarch64 || (defined __riscv && __riscv_xlen == 64)
 
 static bool_t
 xdrposix_getint(xdrs, lp)
