diff --git a/mex/build/matlab/bytecode/Makefile.am b/mex/build/matlab/bytecode/Makefile.am
index 954614256c5911ec9489631b6756b4d5d318a969..7e351742bdbbe50f2013ca634cf14989f7f67a55 100644
--- a/mex/build/matlab/bytecode/Makefile.am
+++ b/mex/build/matlab/bytecode/Makefile.am
@@ -1,2 +1,4 @@
 include ../mex.am
 include ../../bytecode.am
+
+bytecode_LDADD = -lmwumfpack -lut
diff --git a/mex/build/octave/bytecode/Makefile.am b/mex/build/octave/bytecode/Makefile.am
index f55d24f32b85b17dd617f95cb338e3c0a99d6fb9..fe96814b9db7ad73eb879ffe19af2f82067450a2 100644
--- a/mex/build/octave/bytecode/Makefile.am
+++ b/mex/build/octave/bytecode/Makefile.am
@@ -1,3 +1,5 @@
 EXEEXT = .mex
 include ../mex.am
 include ../../bytecode.am
+
+bytecode_LDADD = -lumfpack
diff --git a/mex/sources/bytecode/SparseMatrix.cc b/mex/sources/bytecode/SparseMatrix.cc
index 131c4314a6fadeb14ab7b845767a99aecc5d109e..baf1d9e89d6cb8b1b7bca9749e806cabda7850ba 100644
--- a/mex/sources/bytecode/SparseMatrix.cc
+++ b/mex/sources/bytecode/SparseMatrix.cc
@@ -32,16 +32,10 @@
 #endif
 
 using namespace std;
-#if (defined _MSC_VER || defined OCTAVE_MEX_FILE)
-
 #ifdef _MSC_VER
 #include <windows.h>
 HINSTANCE hinstLib;
-#else
-#include <sys/types.h>
-#include <dlfcn.h>
-void* hinstLib;
-#endif
+
 #define UMFPACK_INFO 90
 #define UMFPACK_CONTROL 20
 /* used in all UMFPACK_report_* routines: */
@@ -50,9 +44,6 @@ void* hinstLib;
 #define UMFPACK_OK (0)
 #define UMFPACK_STATUS 0	/* UMFPACK_OK, or other result */
 
-
-
-
 typedef void (*t_umfpack_dl_free_numeric)(void **Numeric);
 t_umfpack_dl_free_numeric umfpack_dl_free_numeric;
 typedef void (*t_umfpack_dl_free_symbolic)(void **Symbolic);
@@ -117,17 +108,12 @@ dynSparseMatrix::dynSparseMatrix()
   lu_inc_tol = 1e-10;
   Symbolic = NULL;
   Numeric = NULL;
-#if (defined _MSC_VER || defined OCTAVE_MEX_FILE)
-  // Get a handle to the DLL module.
 #ifdef _MSC_VER
+  // Get a handle to the DLL module.
   hinstLib = LoadLibrary(TEXT("libmwumfpack.dll"));
-#else
-  hinstLib = dlopen("libmwumfpack.dll",RTLD_LAZY);
-#endif
   // If the handle is valid, try to get the function address.
   if (hinstLib)
     {
-#ifdef _MSC_VER
       umfpack_dl_free_numeric = (t_umfpack_dl_free_numeric) GetProcAddress(hinstLib, "umfpack_dl_free_numeric");
       if (!umfpack_dl_free_numeric)
         {
@@ -185,97 +171,6 @@ dynSparseMatrix::dynSparseMatrix()
           tmp << " in libmwumfpack.dll, the function umfpack_dl_defaults is not found.";
           throw FatalExceptionHandling(tmp.str());
         }
-/*#else
-      mexPrintf("loading libmwumpfpack\n");
-      // reset errors
-      dlerror();
-      umfpack_dl_free_numeric = (t_umfpack_dl_free_numeric)  dlsym(hinstLib, "umfpack_dl_free_numeric");
-      const char* dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_free_numeric not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_free_numeric is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_free_symbolic = (t_umfpack_dl_free_symbolic)  dlsym(hinstLib, "umfpack_dl_free_symbolic");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_free_symbolic not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_free_symbolic is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_solve = (t_umfpack_dl_solve)  dlsym(hinstLib, "umfpack_dl_solve");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_solve not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_solve is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_numeric = (t_umfpack_dl_numeric)  dlsym(hinstLib, "umfpack_dl_numeric");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_numeric not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_numeric is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_symbolic = (t_umfpack_dl_symbolic)  dlsym(hinstLib, "umfpack_dl_symbolic");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_symbolic not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_symbolic is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_report_info = (t_umfpack_dl_report_info)  dlsym(hinstLib, "umfpack_dl_report_info");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_report_info not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_report_info is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_report_status = (t_umfpack_dl_report_status)  dlsym(hinstLib, "umfpack_dl_report_status");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_report_status not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_report_status is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }
-      // reset errors
-      dlerror();
-      umfpack_dl_defaults = (t_umfpack_dl_defaults)  dlsym(hinstLib, "umfpack_dl_defaults");
-      dlsym_error = dlerror();
-      if (dlsym_error)
-        {
-          mexPrintf("umfpack_dl_defaults not found\n");
-          ostringstream tmp;
-          tmp << " in libmwumfpack.dll, the function umfpack_dl_defaults is not found.";
-          throw FatalExceptionHandling(tmp.str());
-        }*/
-#endif
     }
   else
     {
diff --git a/mex/sources/dynumfpack.h b/mex/sources/dynumfpack.h
index 642e584408f26a3698d23b939cae696ab9607711..60182c47106453f543b98f456a07b45e709fb14b 100644
--- a/mex/sources/dynumfpack.h
+++ b/mex/sources/dynumfpack.h
@@ -1,14 +1,9 @@
 /*
- * Defines the prototypes for BLAS Fortran functions.
- *
- * Also defines a typedef blas_int to be used for all integers passed to BLAS
- * functions.
- *
- * When used in the context of a MATLAB MEX file, you must define MATLAB_MEX_FILE
- * and MATLAB_VERSION (for version 7.4, define it to 0x0704).
- *
- *
- * Copyright (C) 2009-2011 Dynare Team
+ * Defines some prototypes for UMFPACK functions
+ */
+
+/*
+ * Copyright (C) 2013 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -29,26 +24,10 @@
 #ifndef _DYNUMFPACK_H
 #define _DYNUMFPACK_H
 
-/* Starting from version 7.8, MATLAB BLAS expects ptrdiff_t arguments for integers */
-#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION >= 0x0708
-# ifdef __cplusplus
-#  include <cstddef>
-# else
-#  include <stddef.h>
-# endif
-#endif
-/*
-#if defined(MATLAB_MEX_FILE) && defined(_WIN32) && !defined(_MSC_VER)
-# define FORTRAN_WRAPPER(x) x
-#else
-# define FORTRAN_WRAPPER(x) x
-#endif
-*/
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /* -------------------------------------------------------------------------- */
 /* size of Info and Control arrays */
 /* -------------------------------------------------------------------------- */
@@ -64,57 +43,46 @@ extern "C" {
 #define UMFPACK_OK (0)
 #define UMFPACK_STATUS 0	/* UMFPACK_OK, or other result */
 
-
+#ifdef _WIN64
 typedef long long int SuiteSparse_long;
+#else
+typedef long SuiteSparse_long;
+#endif
 
-#define umfpack_dl_defaults FORTRAN_WRAPPER(umfpack_dl_defaults)
 void umfpack_dl_defaults(double Control[UMFPACK_CONTROL]);
 
-#define umfpack_dl_symbolic FORTRAN_WRAPPER(umfpack_dl_symbolic)
 SuiteSparse_long umfpack_dl_symbolic(SuiteSparse_long n_row, SuiteSparse_long n_col,
                                      const SuiteSparse_long Ap [ ], const SuiteSparse_long Ai [ ],
                                      const double Ax [ ], void **Symbolic,
                                      const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]);
 
-#define umfpack_dl_numeric FORTRAN_WRAPPER(umfpack_dl_numeric)
 SuiteSparse_long umfpack_dl_numeric(const SuiteSparse_long Ap [ ], const SuiteSparse_long Ai [ ],
                                     const double Ax [ ], void *Symbolic, void **Numeric,
                                     const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]);
 
-#define umfpack_dl_solve FORTRAN_WRAPPER(umfpack_dl_solve)
 SuiteSparse_long umfpack_dl_solve(SuiteSparse_long sys, const SuiteSparse_long Ap [ ],
                                   const SuiteSparse_long Ai [ ], const double Ax [ ],
                                   double X [ ], const double B [ ], void *Numeric,
                                   const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]);
 
-#define umfpack_dl_report_info FORTRAN_WRAPPER(umfpack_dl_report_info)
 void umfpack_dl_report_info(const double Control [UMFPACK_CONTROL],
                             const double Info [UMFPACK_INFO]);
 
-#define umfpack_dl_report_status FORTRAN_WRAPPER(umfpack_dl_report_status)
 void umfpack_dl_report_status(const double Control [UMFPACK_CONTROL],
                               SuiteSparse_long status);
 
-#define umfpack_dl_free_symbolic FORTRAN_WRAPPER(umfpack_dl_free_symbolic)
 void umfpack_dl_free_symbolic(void **Symbolic);
 
-#define umfpack_dl_free_numeric FORTRAN_WRAPPER(umfpack_dl_free_numeric)
 void umfpack_dl_free_numeric(void **Numeric);
 
-
-#define umfpack_dl_load_symbolic  FORTRAN_WRAPPER(umfpack_dl_load_symbolic )
 SuiteSparse_long umfpack_dl_load_symbolic (void **Symbolic, char *filename) ;
 
-#define umfpack_dl_load_numeric  FORTRAN_WRAPPER(umfpack_dl_load_numeric )
 SuiteSparse_long umfpack_dl_load_numeric (void **Numeric, char *filename) ;
 
-#define umfpack_dl_save_symbolic  FORTRAN_WRAPPER(umfpack_dl_save_symbolic )
 SuiteSparse_long umfpack_dl_save_symbolic (void *Symbolic, char *filename) ;
 
-#define umfpack_dl_save_numeric  FORTRAN_WRAPPER(umfpack_dl_save_numeric )
 SuiteSparse_long umfpack_dl_save_numeric (void *Numeric, char *filename) ;
 
-
 #ifdef __cplusplus
 } /* extern "C" */
 #endif