diff --git a/gcr/Makefile.am b/gcr/Makefile.am
index e6b3a63..dadf901 100644
--- a/gcr/Makefile.am
+++ b/gcr/Makefile.am
@@ -138,7 +138,7 @@ libgcr_base_@GCR_MAJOR@_la_CFLAGS = \
 libgcr_base_@GCR_MAJOR@_la_LDFLAGS = \
 	-version-info $(GCR_LT_RELEASE) \
 	-no-undefined \
-	-export-symbols-regex '^_gcr_.*|^gcr_.*|^SECMEM_.*'
+	-export-symbols-regex '^_gcr_.*|^gcr_.*|^GCR_.*|^SECMEM_.*'
 
 libgcr_base_@GCR_MAJOR@_la_LIBADD = \
 	$(top_builddir)/egg/libegg.la \
diff --git a/gcr/gcr-mkoids b/gcr/gcr-mkoids
index 47d1095..6b19c70 100644
--- a/gcr/gcr-mkoids
+++ b/gcr/gcr-mkoids
@@ -12,10 +12,11 @@ generate_header ()
 	echo "#define ${UPPER}_OIDS_"
 	echo ""
 	echo "void _${LOWER}_oids_init (void);"
+	echo ""
 
 	while read name oid; do
 		if [ -n "$name" ]; then
-			echo "GQuark ${UPPER}_OID_${name};"
+			echo "extern GQuark ${UPPER}_OID_${name};"
 		fi
 	done
 
@@ -25,23 +26,29 @@ generate_header ()
 
 generate_source ()
 {
+	def_oids=""
+	set_oids=""
+	while read name oid; do
+		if [ -n "$name" ]; then
+		     def_oids="$def_oids"$'\n'"GQuark ${UPPER}_OID_${name};"
+		     set_oids="$set_oids"$'\n'"		${UPPER}_OID_${name} = g_quark_from_static_string (\"${oid}\");"
+		fi
+	done
+
 	echo "/* WARNING: file is autogenerated */"
 	echo ""
 	echo "#include \"$HEADER\""
-	echo ""
 
+	echo "$def_oids"
+	echo ""
 	echo "void"
 	echo "_${LOWER}_oids_init (void)"
 	echo "{"
 	echo "	static volatile gsize initialized = 0;"
 	echo "	if (g_once_init_enter (&initialized)) {"
 
-	while read name oid; do
-		if [ -n "$name" ]; then
-			echo "		${UPPER}_OID_${name} = g_quark_from_static_string (\"${oid}\");"
-		fi
-	done
-
+	echo 		"$set_oids"
+	echo ""
 	echo "		g_once_init_leave (&initialized, 1);"
 	echo "	}"
 	echo "}"
-- 
1.8.1.1

