--- /dev/null
+diff -u -r -N SuperLU_DIST_3.3/SRC/dreadMM.c SuperLU_DIST_3.3.patched/SRC/dreadMM.c
+--- SuperLU_DIST_3.3/SRC/dreadMM.c 2013-04-01 02:25:32.000000000 +0200
++++ SuperLU_DIST_3.3.patched/SRC/dreadMM.c 2014-07-11 00:50:25.225586000 +0200
+@@ -8,6 +8,7 @@
+ */
+ #include <stdio.h>
+ #include "superlu_ddefs.h"
++#include "dreadrhs.h"
+
+ #undef EXPAND_SYM
+
+@@ -211,22 +212,3 @@
+ #endif
+
+ }
+-
+-
+-void dreadrhs(int m, double *b)
+-{
+- FILE *fp, *fopen();
+- int i, j;
+-
+- if ( !(fp = fopen("b.dat", "r")) ) {
+- fprintf(stderr, "dreadrhs: file does not exist\n");
+- exit(-1);
+- }
+- for (i = 0; i < m; ++i)
+- fscanf(fp, "%lf\n", &b[i]);
+- /*fscanf(fp, "%d%lf\n", &j, &b[i]);*/
+- /* readpair_(j, &b[i]);*/
+- fclose(fp);
+-}
+-
+-
+diff -u -r -N SuperLU_DIST_3.3/SRC/dreadrhs.c SuperLU_DIST_3.3.patched/SRC/dreadrhs.c
+--- SuperLU_DIST_3.3/SRC/dreadrhs.c 1970-01-01 01:00:00.000000000 +0100
++++ SuperLU_DIST_3.3.patched/SRC/dreadrhs.c 2014-07-11 00:50:25.220586000 +0200
+@@ -0,0 +1,17 @@
++#include "dreadrhs.h"
++
++void dreadrhs(int m, double *b)
++{
++ FILE *fp, *fopen();
++ int i, j;
++
++ if ( !(fp = fopen("b.dat", "r")) ) {
++ fprintf(stderr, "dreadrhs: file does not exist\n");
++ exit(-1);
++ }
++ for (i = 0; i < m; ++i)
++ fscanf(fp, "%lf\n", &b[i]);
++ /*fscanf(fp, "%d%lf\n", &j, &b[i]);*/
++ /* readpair_(j, &b[i]);*/
++ fclose(fp);
++}
+diff -u -r -N SuperLU_DIST_3.3/SRC/dreadrhs.h SuperLU_DIST_3.3.patched/SRC/dreadrhs.h
+--- SuperLU_DIST_3.3/SRC/dreadrhs.h 1970-01-01 01:00:00.000000000 +0100
++++ SuperLU_DIST_3.3.patched/SRC/dreadrhs.h 2014-07-11 00:50:25.215586000 +0200
+@@ -0,0 +1,10 @@
++#ifndef _dreadrhs_h
++#define _dreadrhs_h
++
++#include <stdio.h>
++#include "superlu_ddefs.h"
++
++#undef EXPAND_SYM
++
++void dreadrhs(int m, double *b);
++#endif
+diff -u -r -N SuperLU_DIST_3.3/SRC/dreadtriple.c SuperLU_DIST_3.3.patched/SRC/dreadtriple.c
+--- SuperLU_DIST_3.3/SRC/dreadtriple.c 2013-04-01 02:25:31.000000000 +0200
++++ SuperLU_DIST_3.3.patched/SRC/dreadtriple.c 2014-07-11 00:50:25.219586000 +0200
+@@ -6,6 +6,7 @@
+ */
+ #include <stdio.h>
+ #include "superlu_ddefs.h"
++#include "dreadrhs.h"
+
+ #undef EXPAND_SYM
+
+@@ -149,22 +150,3 @@
+
+ }
+
+-
+-void dreadrhs(int m, double *b)
+-{
+- FILE *fp, *fopen();
+- int i, j;
+-
+- if ( !(fp = fopen("b.dat", "r")) ) {
+- fprintf(stderr, "dreadrhs: file does not exist\n");
+- exit(-1);
+- }
+- for (i = 0; i < m; ++i)
+- fscanf(fp, "%lf\n", &b[i]);
+- /*fscanf(fp, "%d%lf\n", &j, &b[i]);*/
+- /* readpair_(j, &b[i]);*/
+-
+- fclose(fp);
+-}
+-
+-
+diff -u -r -N SuperLU_DIST_3.3/SRC/Makefile SuperLU_DIST_3.3.patched/SRC/Makefile
+--- SuperLU_DIST_3.3/SRC/Makefile 2013-04-01 02:25:31.000000000 +0200
++++ SuperLU_DIST_3.3.patched/SRC/Makefile 2014-07-11 00:50:25.218586000 +0200
+@@ -43,12 +43,12 @@
+ DSLUSRC = dlangs.o dgsequ.o dlaqgs.o dutil.o \
+ dmemory.o dmyblas2.o dsp_blas2.o dsp_blas3.o
+ ZSLUSRC = dcomplex.o zlangs.o zgsequ.o zlaqgs.o zutil.o \
+- zmemory.o zmyblas2.o dmemory.o zsp_blas2.o zsp_blas3.o
++ zmemory.o zmyblas2.o zsp_blas2.o zsp_blas3.o
+
+ #
+ # Routines for double precision parallel SuperLU
+ # DPLUSRC = dldperm.o ddistribute.o pdgstrf.o pdgstrs_Bglobal.o
+-DPLUSRC = dldperm.o ddistribute.o pdgstrf.o pdgstrs_Bglobal.o \
++DPLUSRC = dreadrhs.o dldperm.o ddistribute.o pdgstrf.o pdgstrs_Bglobal.o \
+ pdgstrs1.o pdgssvx_ABglobal.o pdgsrfs_ABXglobal.o pdgsmv_AXglobal.o\
+ pdgssvx.o pdgstrs.o pddistribute.o pdlangs.o pdutil.o \
+ pdgsequ.o pdlaqgs.o pdgsrfs.o pdgsmv.o pdgstrs_lsum.o \
+@@ -57,23 +57,28 @@
+ #
+ # Routines for double complex parallel SuperLU
+ # ZPLUSRC = zldperm.o zdistribute.o pzgssvx_ABglobal.o pzgstrf_irecv.o
+-ZPLUSRC = zldperm.o zdistribute.o pzgssvx_ABglobal.o pzgstrf.o \
++ZPLUSRC = zreadrhs.o zldperm.o zdistribute.o pzgssvx_ABglobal.o pzgstrf.o \
+ pzgstrs1.o pzgstrs_Bglobal.o pzgsrfs_ABXglobal.o pzgsmv_AXglobal.o \
+ pzgssvx.o pzgstrs.o pzdistribute.o pzlangs.o pzutil.o \
+ pzgsequ.o pzlaqgs.o pzgsrfs.o pzgsmv.o pzgstrs_lsum.o \
+ pzsymbfact_distdata.o zreadhb.o zreadtriple.o zreadMM.o
+
+-all: double complex16
++all: double complex16 shared
+
+ double: $(DSLUSRC) $(DPLUSRC) $(ALLAUX) $(LAAUX)
+- $(ARCH) $(ARCHFLAGS) $(DSUPERLULIB) \
++ $(ARCH) $(ARCHFLAGS) $(DSUPERLULIB).a \
+ $(DSLUSRC) $(DPLUSRC) $(ALLAUX) $(LAAUX)
+- $(RANLIB) $(DSUPERLULIB)
++ $(RANLIB) $(DSUPERLULIB).a
+
+ complex16: $(ZSLUSRC) $(ZPLUSRC) $(ALLAUX) $(LAAUX)
+- $(ARCH) $(ARCHFLAGS) $(DSUPERLULIB) \
+- $(ZSLUSRC) $(ZPLUSRC) $(ALLAUX) $(LAAUX)
+- $(RANLIB) $(DSUPERLULIB)
++ $(ARCH) $(ARCHFLAGS) $(DSUPERLULIB).a \
++ $(ZSLUSRC) dmemory.o $(ZPLUSRC) $(ALLAUX) $(LAAUX)
++ $(RANLIB) $(DSUPERLULIB).a
++
++# link shared library
++shared: $(DSLUSRC) $(DPLUSRC) $(ZSLUSRC) $(ZPLUSRC) $(ALLAUX) $(LAAUX)
++ $(CC) -shared -Wl,-soname,$(DSUPERLULIBNAME).so -o $(DSUPERLULIB).so \
++ $(DSLUSRC) $(DPLUSRC) $(ZSLUSRC) $(ZPLUSRC) $(ALLAUX) $(LAAUX)
+
+
+ ##################################
+@@ -90,6 +95,6 @@
+ $(FORTRAN) $(FFLAGS) -c $< $(VERBOSE)
+
+ clean:
+- rm -f *.o $(DSUPERLULIB)
++ rm -f *.o $(DSUPERLULIB).a $(DSUPERLULIB).so
+
+
+diff -u -r -N SuperLU_DIST_3.3/SRC/zreadMM.c SuperLU_DIST_3.3.patched/SRC/zreadMM.c
+--- SuperLU_DIST_3.3/SRC/zreadMM.c 2013-04-01 02:25:31.000000000 +0200
++++ SuperLU_DIST_3.3.patched/SRC/zreadMM.c 2014-07-11 00:50:25.222586000 +0200
+@@ -7,6 +7,7 @@
+ */
+ #include <stdio.h>
+ #include "superlu_zdefs.h"
++#include "zreadrhs.h"
+
+ #undef EXPAND_SYM
+
+@@ -210,20 +211,3 @@
+ #endif
+
+ }
+-
+-
+-void zreadrhs(int m, doublecomplex *b)
+-{
+- FILE *fp, *fopen();
+- int i, j;
+-
+- if ( !(fp = fopen("b.dat", "r")) ) {
+- fprintf(stderr, "zreadrhs: file does not exist\n");
+- exit(-1);
+- }
+- for (i = 0; i < m; ++i)
+- fscanf(fp, "%lf\n", &b[i].r, &b[i].i);
+- fclose(fp);
+-}
+-
+-
+diff -u -r -N SuperLU_DIST_3.3/SRC/zreadrhs.c SuperLU_DIST_3.3.patched/SRC/zreadrhs.c
+--- SuperLU_DIST_3.3/SRC/zreadrhs.c 1970-01-01 01:00:00.000000000 +0100
++++ SuperLU_DIST_3.3.patched/SRC/zreadrhs.c 2014-07-11 00:50:25.224586000 +0200
+@@ -0,0 +1,16 @@
++#include "zreadrhs.h"
++
++void zreadrhs(int m, doublecomplex *b)
++{
++ FILE *fp, *fopen();
++ int i, j;
++
++ if ( !(fp = fopen("b.dat", "r")) ) {
++ fprintf(stderr, "zreadrhs: file does not exist\n");
++ exit(-1);
++ }
++ for (i = 0; i < m; ++i)
++ fscanf(fp, "%lf%lf\n", &(b[i].r), &(b[i].i));
++
++ fclose(fp);
++}
+diff -u -r -N SuperLU_DIST_3.3/SRC/zreadrhs.h SuperLU_DIST_3.3.patched/SRC/zreadrhs.h
+--- SuperLU_DIST_3.3/SRC/zreadrhs.h 1970-01-01 01:00:00.000000000 +0100
++++ SuperLU_DIST_3.3.patched/SRC/zreadrhs.h 2014-07-11 00:50:25.226586000 +0200
+@@ -0,0 +1,10 @@
++#ifndef _zreadrhs_h
++#define _zreadrhs_h
++
++#include <stdio.h>
++#include "superlu_zdefs.h"
++
++#undef EXPAND_SYM
++
++void zreadrhs(int m, doublecomplex *b);
++#endif
+diff -u -r -N SuperLU_DIST_3.3/SRC/zreadtriple.c SuperLU_DIST_3.3.patched/SRC/zreadtriple.c
+--- SuperLU_DIST_3.3/SRC/zreadtriple.c 2013-04-01 02:25:32.000000000 +0200
++++ SuperLU_DIST_3.3.patched/SRC/zreadtriple.c 2014-07-11 00:50:25.225586000 +0200
+@@ -5,6 +5,7 @@
+ */
+ #include <stdio.h>
+ #include "superlu_zdefs.h"
++#include "zreadrhs.h"
+
+ #undef EXPAND_SYM
+
+@@ -147,21 +148,3 @@
+ #endif
+
+ }
+-
+-
+-void zreadrhs(int m, doublecomplex *b)
+-{
+- FILE *fp, *fopen();
+- int i, j;
+-
+- if ( !(fp = fopen("b.dat", "r")) ) {
+- fprintf(stderr, "zreadrhs: file does not exist\n");
+- exit(-1);
+- }
+- for (i = 0; i < m; ++i)
+- fscanf(fp, "%lf%lf\n", &(b[i].r), &(b[i].i));
+-
+- fclose(fp);
+-}
+-
+-