diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
index e52297e2c4ddef0b64d57703313dbb7fc835ac05..08f61902b83fc119a1e06ef37476c74c62a43dc4 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
@@ -217,8 +217,11 @@ bool Foam::functionEntries::codeStream::execute
 
 
     // Find the library handle.
-    void (*function)(const dictionary&, Ostream& os);
-    *(void **) (&function) = dlSym(lib, name);
+    void (*function)(const dictionary&, Ostream&);
+    function = reinterpret_cast<void(*)(const dictionary&, Ostream&)>
+    (
+        dlSym(lib, name)
+    );
 
     if (!function)
     {