diff --git a/c/opendht.cpp b/c/opendht.cpp
index 55e202d30beb7b93136926af45df00bd28712909..282bc5d97c52454d6514d01b497c5ddf354ac75a 100644
--- a/c/opendht.cpp
+++ b/c/opendht.cpp
@@ -124,7 +124,7 @@ void dht_publickey_delete(dht_publickey* pk) {
 
 int dht_publickey_export(const dht_publickey* pk, char* out, size_t* outlen) {
     const auto& pkey = *reinterpret_cast<const PubkeySp*>(pk);
-    return pkey->pack(out, outlen);
+    return pkey->pack((uint8_t*)out, outlen);
 }
 
 dht_infohash dht_publickey_get_id(const dht_publickey* pk) {