diff --git a/src/DynareMain.cc b/src/DynareMain.cc
index a03a386c5c0895bfaf3508c1de3689806624e4ae..6715c6ac9b03c1946081578b2bc27a5a82edb6cb 100644
--- a/src/DynareMain.cc
+++ b/src/DynareMain.cc
@@ -57,7 +57,7 @@ usage()
        << " [-D<variable>[=<value>]] [-I/path] [nostrict] [stochastic] [fast] [minimal_workspace] [compute_xrefs] [output=dynamic|first|second|third] [language=matlab|julia]"
        << " [params_derivs_order=0|1|2] [transform_unary_ops] [exclude_eqs=<equation_tag_list_or_file>] [include_eqs=<equation_tag_list_or_file>]"
        << " [json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonderivsimple] [nopathchange] [nopreprocessoroutput]"
-       << " [mexext=<extension>] [matlabroot=<path>] [onlymodel] [notime]"
+       << " [mexext=<extension>] [matlabroot=<path>] [onlymodel] [notime] [use_dll]"
        << endl;
   exit(EXIT_FAILURE);
 }
@@ -166,6 +166,7 @@ main(int argc, char **argv)
   dynareroot = dynareroot.parent_path();
   dynareroot = dynareroot / ".." / "..";
   bool onlymodel = false;
+  bool use_dll = false;
 
   for (auto s : options)
     {
@@ -400,6 +401,8 @@ main(int argc, char **argv)
         onlymodel = true;
       else if (s == "gui")
         gui = true;
+      else if (s == "use_dll")
+        use_dll = true;
       else
         {
           cerr << "Unknown option: " << s << endl;
@@ -454,6 +457,11 @@ main(int argc, char **argv)
 
   // Do parsing and construct internal representation of mod file
   unique_ptr<ModFile> mod_file = p.parse(macro_output, debug);
+
+  // Handle use_dll option specified on the command line
+  if (use_dll)
+    mod_file->use_dll = true;
+
   if (json == JsonOutputPointType::parsing)
     mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson);
 
diff --git a/src/ModFile.hh b/src/ModFile.hh
index 16a3b3d2624d659f9cf80214d7c3ceab4ce6708e..fbcaaa135f2c8f21e1a85f2fb29a15a6fdb48a72 100644
--- a/src/ModFile.hh
+++ b/src/ModFile.hh
@@ -85,7 +85,8 @@ public:
   //! Is the model stored in bytecode format (bytecode=true) or in a M-file (bytecode=false)
   bool bytecode{false};
 
-  //! Is the model stored in a MEX file ? (option "use_dll" of "model")
+  /*! Is the model stored in a MEX file ? (option “use_dll”, either in the
+    “model” block or on the preprocessor command line) */
   bool use_dll{false};
 
   //! Is the static model have to computed (no_static=false) or not (no_static=true). Option of 'model'