diff --git a/src/xpdev/dat_file.c b/src/xpdev/dat_file.c
index 0271fb088c32d5cab7daf231fe7978acff8318d5..418f3ff95f159f88989ad58fc0a7387df73daf14 100644
--- a/src/xpdev/dat_file.c
+++ b/src/xpdev/dat_file.c
@@ -41,8 +41,6 @@
 #include <stdlib.h>		/* malloc */
 #include <string.h>		/* strdup */
 
-#include "truncsp.c"	/* truncsp() and truncnl() */
-
 /***********************************/
 /* CSV (Comma Separated Value) API */
 /***********************************/
diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c
index 1299e8ee27cceca547e162fa042aa0448eb5bf01..c71a623284226a138734145e21ce3d59b6cbad82 100644
--- a/src/xpdev/genwrap.c
+++ b/src/xpdev/genwrap.c
@@ -416,3 +416,31 @@ clock_t DLLCALL msclock(void)
 	return((clock_t)(usecs/(1000000/MSCLOCKS_PER_SEC)));
 }
 #endif
+
+/****************************************************************************/
+/* Truncates all white-space chars off end of 'str'	(needed by STRERRROR)	*/
+/****************************************************************************/
+char* DLLCALL truncsp(char* str)
+{
+	unsigned c;
+
+	c=strlen(str);
+	while(c && (str[c-1]==' ' || str[c-1]=='\t' || str[c-1]=='\r' || str[c-1]=='\n')) c--;
+	str[c]=0;
+
+	return(str);
+}
+
+/****************************************************************************/
+/* Truncates carriage-return and line-feed chars off end of 'str'			*/
+/****************************************************************************/
+char* DLLCALL truncnl(char* str)
+{
+	unsigned c;
+
+	c=strlen(str);
+	while(c && (str[c-1]=='\r' || str[c-1]=='\n')) c--;
+	str[c]=0;
+
+	return(str);
+}
diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h
index 31ce7a1ed1a9c149df1fdead63f4dfa873386331..dcf372a4615f57526638b1f38db4c450654cef8d 100644
--- a/src/xpdev/genwrap.h
+++ b/src/xpdev/genwrap.h
@@ -171,6 +171,11 @@ extern "C" {
 	#endif
 #endif
 
+/* Truncate white-space chars off end of string */
+DLLEXPORT char*		DLLCALL truncsp(char* str);
+/* Truncate new-line chars off end of string */
+DLLEXPORT char*		DLLCALL truncnl(char* str);
+
 #if defined(__unix__)
 	#define STRERROR(x)		strerror(x)
 #else
diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c
index 465fd16f56ea3d36a140f953a1245874bff58cf1..0ea9e8ac0219b97921ce352f58986f6d0a5a4130 100644
--- a/src/xpdev/ini_file.c
+++ b/src/xpdev/ini_file.c
@@ -54,8 +54,6 @@
 
 static ini_style_t default_style;
 
-#include "truncsp.c"	/* truncsp() and truncnl() */
-
 static char* section_name(char* p)
 {
 	char*	tp;