diff --git a/DESCRIPTION b/DESCRIPTION
index 30c1c98cecfd3a28390753983f42d0393297fe23..b963920a2fb117aab52a2c387d589df28736c242 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: cplexAPI
 Type: Package
 Title: R Interface to C API of IBM ILOG CPLEX
-Version: 1.3.6
-Date: 2019-06-21
+Version: 1.4.0
+Date: 2020-09-17
 Authors@R: c(person("Mayo", "Roettger", role = "cre", email = "mayo.roettger@hhu.de"),
              person("Gabriel", "Gelius-Dietrich", role = "aut", email = "geliudie@uni-duesseldorf.de"),
              person(c("C.", "Jonathan"), "Fritzemeier", role = c("ctb"), email = "clausjonathan.fritzemeier@uni-duesseldorf.de"))
@@ -14,7 +14,7 @@ License: GPL-3 | file LICENSE
 LazyLoad: yes
 Collate: generics.R cplexConst.R cplexErrorClass.R cplexPtrClass.R
         cplex.R cplexAPI.R cplex_checkAPI.R cplex_longparamAPI.R zzz.R
-Packaged: 2019-06-21 11:35:00 UTC; mayo
+Packaged: 2020-09-17 12:58:00 UTC; mayo
 NeedsCompilation: yes
 Repository: CRAN
-Date/Publication: 2019-06-21 11:35:00
+Date/Publication: 2020-09-17 14:58:00
diff --git a/NAMESPACE b/NAMESPACE
index 4b1244efe6880e20068038f3d2a551d19b5f089e..3e10e896b3087ebcdff161f8de749369eeb33fda 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -63,7 +63,6 @@ copyLpCPLEX,
 copyLpwNamesCPLEX,
 copyObjNameCPLEX,
 copyOrderCPLEX,
-copyPartBaseCPLEX,
 copyQPsepCPLEX,
 copyQuadCPLEX,
 copyStartCPLEX,
diff --git a/R/cplex.R b/R/cplex.R
index 95d5beaf3a4859a00d8cb5187fa13ddb12a1c328..a310f5a01a5278dffd524d80ab20806124cd8324 100644
--- a/R/cplex.R
+++ b/R/cplex.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cplex.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/cplexAPI.R b/R/cplexAPI.R
index c60856bd8f4f4de418f5b9b33d6d4932aade0994..0bb5274b49b4f515554960fb03b12913fbf9bd08 100644
--- a/R/cplexAPI.R
+++ b/R/cplexAPI.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cplexAPI.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
@@ -1674,26 +1674,6 @@ copyBaseCPLEX <- function(env, lp, cstat, rstat) {
 }
 
 
-#------------------------------------------------------------------------------#
-
-copyPartBaseCPLEX <- function(env, lp, ncind, cind, cstat,
-                                       nrind, rind, rstat) {
-
-    status <- .Call("copyPartBase", PACKAGE = "cplexAPI",
-                    cplexPointer(env),
-                    cplexPointer(lp),
-                    as.integer(ncind),
-                    as.integer(cind),
-                    as.integer(cstat),
-                    as.integer(nrind),
-                    as.integer(rind),
-                    as.integer(rstat)
-              )
-
-    return(status)
-}
-
-
 #------------------------------------------------------------------------------#
 
 getBaseCPLEX <- function(env, lp) {
diff --git a/R/cplexConst.R b/R/cplexConst.R
index 8110c91591e69a3bb87c2fc6c1491b9f56873095..51d42ac2381a772ee869211d4423f529d6c84775 100644
--- a/R/cplexConst.R
+++ b/R/cplexConst.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cplexConst.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/cplexErrorClass.R b/R/cplexErrorClass.R
index 5825a9793b1dfb2187235f277d312d9d6bc4d156..437c9f92eca68313ffaa8a99e333d4e5d5ea9bf1 100644
--- a/R/cplexErrorClass.R
+++ b/R/cplexErrorClass.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cpxerrClass.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/cplexPtrClass.R b/R/cplexPtrClass.R
index 8fc3cdf117dc0234747d4e890d5c3f6f20b18c08..c619419ffe02e8dae67558c0228060676988565d 100644
--- a/R/cplexPtrClass.R
+++ b/R/cplexPtrClass.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cplex_ptrClass.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/cplex_checkAPI.R b/R/cplex_checkAPI.R
index 919e189ff6ed2c86726b04eae636c7c207baebe9..e355d4f9e9946638713467d698b22fcedc650495 100644
--- a/R/cplex_checkAPI.R
+++ b/R/cplex_checkAPI.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cplex_checkAPI.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/cplex_longparamAPI.R b/R/cplex_longparamAPI.R
index 0bfbaf07f2ef0bc1e4383be0289ec44b73a330b4..e62f66ead51a46bf271960a7f7e7312de2ce0033 100644
--- a/R/cplex_longparamAPI.R
+++ b/R/cplex_longparamAPI.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  cplex_longparamAPI.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/generics.R b/R/generics.R
index f20834a8bba2298dd33a35a4f2317303c6ed224e..c0a3887132daa53fee7e4ec139367a4c00ccbd40 100644
--- a/R/generics.R
+++ b/R/generics.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  generics.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/R/zzz.R b/R/zzz.R
index 00559f540b31f58ddb72ad00c93c657bc13fadbd..da50130c28f159f94fc31d58c5aa39dbdcf9954e 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------#
 
 #  zzz.R
-#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+#  R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 #
 #  Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
 #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
@@ -28,8 +28,17 @@
 
 .packageName <- "cplexAPI"
 
+# Finalize function for cplexAPI:
+finalize <- function(env) {
+    .Call("finalizeCPLEX", PACKAGE = "cplexAPI")
+}
+
 .onLoad <- function(libname, pkgname) {
     .Call("initCPLEX", PACKAGE = "cplexAPI")
+    
+    # set finalizer for namespace:cplexAPI environment:
+    parent <- parent.env(environment())
+    reg.finalizer(parent, finalize, onexit = TRUE)
 }
 
 #.onAttach <- function(libname, pkgname) {
diff --git a/configure b/configure
index 5672c3d113769600cd3a8ccaba5313253d7bfdcd..d127ebeba6031056bead8877c880eeab1cae93c8 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for cplexAPI 1.3.6.
+# Generated by GNU Autoconf 2.69 for cplexAPI 1.4.0.
 #
 # Report bugs to <mayo.roettger@hhu.de>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='cplexAPI'
 PACKAGE_TARNAME='cplexapi'
-PACKAGE_VERSION='1.3.6'
-PACKAGE_STRING='cplexAPI 1.3.6'
+PACKAGE_VERSION='1.4.0'
+PACKAGE_STRING='cplexAPI 1.4.0'
 PACKAGE_BUGREPORT='mayo.roettger@hhu.de'
 PACKAGE_URL=''
 
@@ -1246,7 +1246,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cplexAPI 1.3.6 to adapt to many kinds of systems.
+\`configure' configures cplexAPI 1.4.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1308,7 +1308,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cplexAPI 1.3.6:";;
+     short | recursive ) echo "Configuration of cplexAPI 1.4.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1399,7 +1399,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cplexAPI configure 1.3.6
+cplexAPI configure 1.4.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1701,7 +1701,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cplexAPI $as_me 1.3.6, which was
+It was created by cplexAPI $as_me 1.4.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2062,7 +2062,7 @@ if test -z "${R_HOME}"; then
 fi
 
 CC=`"${R_HOME}/bin/R" CMD config CC`
-CPP=`"${R_HOME}/bin/R" CMD config CPP`
+#CPP=`"${R_HOME}/bin/R" CMD config CPP`
 CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
 CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
 ac_ext=c
@@ -3153,7 +3153,8 @@ $as_echo "no" >&6; }
 fi
 
 
-
+    { $as_echo "$as_me:${as_lineno-$LINENO}: NOTICE $CPLEX_BIN ermittelt" >&5
+$as_echo "$as_me: NOTICE $CPLEX_BIN ermittelt" >&6;}
     if test  "$CPLEX_BIN" = "NONE"  ; then
         as_fn_error $? "CPLEX interactive optimizer not found" "$LINENO" 5
     else
@@ -3180,7 +3181,7 @@ $as_echo X"$CPLEX_BIN" |
 	    q
 	  }
 	  s/.*/./; q'`
-        MACHINE=`expr //$CPLEX_DIR : '.*/\(.*\)'`
+                MACHINE=`expr //$CPLEX_DIR : '.*/\(.*\)'`
         CPLEX_DIR=`$as_dirname -- "$CPLEX_DIR" ||
 $as_expr X"$CPLEX_DIR" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$CPLEX_DIR" : 'X\(//\)[^/]' \| \
@@ -3282,11 +3283,15 @@ done
 
 
     if test  ! -d "$CPLEX_DIR/include"  ; then
-        as_fn_error $? "CPLEX install directory not found: $CPLEX_DIR/include does not exist" "$LINENO" 5
+        if test  -d "$CPLEX_DIR/cplex/include"  ; then
+                                    CPLEX_DIR="$CPLEX_DIR/cplex"
+        else
+            as_fn_error $? "CPLEX install directory not found: $CPLEX_DIR/include does not exist" "$LINENO" 5
+        fi
     fi
 
     if test  -z "$MACHINE"  ; then
-        MACHINE=`ls -l ${CPLEX_DIR}/lib | ${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
+                MACHINE=`ls -l ${CPLEX_DIR}/lib | ${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
         if test  -z "$MACHINE" -o ! -d "$CPLEX_DIR/lib/${MACHINE}"  ; then
             as_fn_error $? "could not determine platform type" "$LINENO" 5
         fi
@@ -3314,6 +3319,8 @@ $as_echo "$as_me: path to example Makefile is $CPLEX_MAKEFILE" >&6;}
 
     if test  "${MAKEFILEVERSION}" = "-lcplex"  ; then
         CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=3;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`"
+    elif test "${MAKEFILEVERSION}" = '-l$(CPLEXLIB)' ; then
+                CPLEX_LIBS="-L${CPLEXLIBDIR} -lcplex `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`"
     else
         CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`"
     fi
@@ -3349,7 +3356,7 @@ fi
 
 
 if test  -n "${CPLEX_CHECK_PATH}" -a "${NO_CHECK}" = "FALSE"  ; then
-    if test  -e "${CPLEX_CHECK_PATH}/check.c" -a -r "${CPLEX_CHECK_PATH}/check.c"  ; then
+        if test  -r "${CPLEX_CHECK_PATH}/check.c"  ; then
         cp ${CPLEX_CHECK_PATH}/check.c src/
         if test  -r "src/check.c"  ; then
             echo "#define printf Rprintf" | cat - src/check.c > src/tmp.c
@@ -4227,7 +4234,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cplexAPI $as_me 1.3.6, which was
+This file was extended by cplexAPI $as_me 1.4.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4289,7 +4296,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-cplexAPI config.status 1.3.6
+cplexAPI config.status 1.4.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 397fdc819804160f96171651e954556b5169e3e8..bc2aeb3a84c40223409fb40480424c394b7e27b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([cplexAPI], [1.3.6], [mayo.roettger@hhu.de])
+AC_INIT([cplexAPI], [1.4.0], [mayo.roettger@hhu.de])
 
 ## adopted from configure.ac in Rcplex_0.3-0
 
@@ -23,7 +23,7 @@ fi
 
 dnl # GNU R default settings
 CC=`"${R_HOME}/bin/R" CMD config CC`
-CPP=`"${R_HOME}/bin/R" CMD config CPP`
+#CPP=`"${R_HOME}/bin/R" CMD config CPP`
 CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
 CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
 AC_PROG_CC
@@ -152,11 +152,12 @@ dnl # install directory (guess)
 if test [ "$ARGS_OK" = "FALSE" -a -z "$CPLEX_DIR" ] ; then
 
     AC_PATH_PROG(CPLEX_BIN, cplex, "NONE")
-    
+    AC_MSG_NOTICE([NOTICE $CPLEX_BIN ermittelt])
     if test [ "$CPLEX_BIN" = "NONE" ] ; then
         AC_MSG_ERROR([CPLEX interactive optimizer not found])
     else
         CPLEX_DIR=`AS_DIRNAME(["$CPLEX_BIN"])`
+        dnl # get name of last folder in the path. This is the MACHINE.
         MACHINE=`expr //$CPLEX_DIR : '.*/\(.*\)'`
         CPLEX_DIR=`AS_DIRNAME(["$CPLEX_DIR"])`
         if test [ -z "$MACHINE" -o ! -d "${CPLEX_DIR}/${MACHINE}" ] ; then
@@ -171,14 +172,21 @@ fi
 dnl # install directory (--with-cplex-dir)
 if test [ "$ARGS_OK" = "FALSE" ] ; then
 
-dnl check for awk
+dnl # check for awk
     AC_PROG_AWK
 
     if test [ ! -d "$CPLEX_DIR/include" ] ; then
-        AC_MSG_ERROR([CPLEX install directory not found: $CPLEX_DIR/include does not exist])
+        if test [ -d "$CPLEX_DIR/cplex/include" ] ; then
+            dnl # if user set only the name of the installation directory
+            dnl # and not the cplex directory inside it
+            CPLEX_DIR="$CPLEX_DIR/cplex"
+        else
+            AC_MSG_ERROR([CPLEX install directory not found: $CPLEX_DIR/include does not exist])
+        fi
     fi
 
     if test [ -z "$MACHINE" ] ; then
+        dnl # extract first directory name within cplex lib directory:
         MACHINE=`ls -l ${CPLEX_DIR}/lib | ${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
         if test [ -z "$MACHINE" -o ! -d "$CPLEX_DIR/lib/${MACHINE}" ] ; then
             AC_MSG_ERROR([could not determine platform type])
@@ -204,6 +212,9 @@ dnl check for awk
     
     if test [ "${MAKEFILEVERSION}" = "-lcplex" ] ; then
         CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=3;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`"
+    elif test "${MAKEFILEVERSION}" = '-l$(CPLEXLIB)' ; then
+        dnl # adaptation to newer versions of CPLEX
+        CPLEX_LIBS="-L${CPLEXLIBDIR} -lcplex `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`"
     else
         CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`"
     fi
@@ -239,7 +250,8 @@ fi
 
 dnl # debugging routines
 if test [ -n "${CPLEX_CHECK_PATH}" -a "${NO_CHECK}" = "FALSE" ] ; then
-    if test [ -e "${CPLEX_CHECK_PATH}/check.c" -a -r "${CPLEX_CHECK_PATH}/check.c" ] ; then
+    dnl # removed because redundant check -e: if test [ -e "${CPLEX_CHECK_PATH}/check.c" -a -r "${CPLEX_CHECK_PATH}/check.c" ] ; then
+    if test [ -r "${CPLEX_CHECK_PATH}/check.c" ] ; then
         cp ${CPLEX_CHECK_PATH}/check.c src/
         if test [ -r "src/check.c" ] ; then
             echo "#define printf Rprintf" | cat - src/check.c > src/tmp.c
@@ -288,6 +300,8 @@ dnl # --------------------------------------------------------------------
 AC_SUBST(PKG_CFLAGS)
 AC_SUBST(PKG_LIBS)
 AC_SUBST(PKG_CPPFLAGS)
-AC_OUTPUT(src/Makevars)
+AC_CONFIG_FILES(src/Makevars)
+AC_OUTPUT
+dnl # removed deprecated: AC_OUTPUT(src/Makevars)
 
 exit 0
diff --git a/inst/INSTALL b/inst/INSTALL
index 8d8b228939bfe004acd4f1a06a79a7ba7d471441..edbc2b6cff82b2ca80ed4186d377c4d64beb582f 100644
--- a/inst/INSTALL
+++ b/inst/INSTALL
@@ -69,9 +69,7 @@ There are several ways of installing the cplexAPI package:
 
    --with-cplex-dir=PATH
    
-   with PATH being the CPLEX directory. This is not the CPLEX installation
-   directory <cplex_dir>, it is the directory including the lib/ include/ and
-   examples/ directory. Usually this is <cplex_dir>/cplex.
+   with PATH being the CPLEX directory.
 
    R CMD INSTALL --configure-args=" 
    --with-cplex-dir='<cplex_dir>/cplex'" \
@@ -88,7 +86,7 @@ There are several ways of installing the cplexAPI package:
    This procedure will try to find the CPLEX interactive optimizer, or the
    CPLEX_BIN environment variable pointing to the CPLEX interactive optimizer
    will be used. The directory two levels above is used as CPLEX directory, all
-   other information is taken from teh CPLEX example Makefile as in #3 above.
+   other information is taken from the CPLEX example Makefile as in #3 above.
 
 
 # ---------------------------------------------------------------------------- #
@@ -99,10 +97,14 @@ For the installation on Windows systems the file Makewars.win in src/ is
 required. The file looks like this:
 
 PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR}\cplex\include"
-PKG_LIBS=-L"${CPLEX_STUDIO_LIB32}" -L"${CPLEX_STUDIO_LIB64}" -lm -lcplex124
+PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex12100
 
-with the environment variable CPLEX_PATH being the installation directory
-of CPLEX. This procedure was tested successfully on 32-bit Windows XP.
+with the environment variable CPLEX_STUDIO_DIR being the installation directory
+of CPLEX and CPLEX_STUDIO_LIB being the library directory of CPLEX (for example
+C:/PROGRA~1/IBM/ILOG/CPLEX_Studio128/cplex/bin/x64_win64). 
+
+This procedure was tested successfully with IBM ILOG CPLEX 12.10  
+on 64-bit Windows 10 using Rtools 3.5.
 
 
 # ---------------------------------------------------------------------------- #
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 4b769ce093393968ff07979ac0102f64ccef3677..e12d914d7163d3a5c54939f005ba05b1a9629304 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -3,6 +3,24 @@
 \name{NEWS}
 \title{cplexAPI News}
 \encoding{UTF-8}
+% ---------------------------------------------------------------------------- %
+\section{Changes in version 1.4.0 2020-09-17}{
+  \itemize{
+    \item Removed function \code{copyPartBaseCPLEX}, because corresponding CPLEX function \code{CPXcopypartialbase} was removed in CPLEX
+    Version >= 12.10.0.
+    \item Adaptation of configure script to extract correct linker options from example Makefile in CPLEX versions >= 10.9.0, 
+    if neither environment variables PKG_CPPFLAGS and PKG_LIBS, nor configure arguments --with-cplex-include and --with-cplex-lib are given, 
+    and option --with-cplex-dir was given or the respective directory could be extracted from the path variable.
+    \item Adaptation of configure script to allow more flexibitlity in specifying the CPLEX installation directory with option --with-cplex-dir.
+    \item Adaptation of Makevars.win to work with CPLEX version 12.10.0.
+    \item According to a comment from Daniel Junglas, CPLEX functions \code{CPXinitialize} and \code{CPXfinalize} should be called when the 
+    shared library is loaded and unloaded to prevent subtle bugs. \code{CPXinitialize} is now called within cplexAPI's \code{.onload()} hook. 
+    CPXfinalize() is called via a finalizer of the namespace:cplexAPI environment.
+    \item Small correction in INSTALL file to give the correct information for Windows installation.
+  }
+}
+
+
 % ---------------------------------------------------------------------------- %
 \section{Changes in version 1.3.6 2019-06-21}{
   \itemize{
diff --git a/inst/c2r.map b/inst/c2r.map
index 56b4c0ceff9c318afe5730f03b44541dd09ba685..3738e914c1e3eaf4ef8615f7749be7278ab0c8b4 100644
--- a/inst/c2r.map
+++ b/inst/c2r.map
@@ -55,7 +55,6 @@ CPXcopylp                    <- cplexAPI::copyLpCPLEX
 CPXcopylpwnames              <- cplexAPI::copyLpwNamesCPLEX
 CPXcopyobjname               <- cplexAPI::copyObjNameCPLEX
 CPXcopyorder                 <- cplexAPI::copyOrderCPLEX
-CPXcopypartialbase           <- cplexAPI::copyPartBaseCPLEX
 CPXcopyqpsep                 <- cplexAPI::copyQPsepCPLEX
 CPXcopyquad                  <- cplexAPI::copyQuadCPLEX
 CPXcopystart                 <- cplexAPI::copyStartCPLEX
diff --git a/man/copyPartBaseCPLEX.Rd b/man/copyPartBaseCPLEX.Rd
deleted file mode 100644
index 552849bfbc9263f8c61d568c99a74a04cbd18b99..0000000000000000000000000000000000000000
--- a/man/copyPartBaseCPLEX.Rd
+++ /dev/null
@@ -1,76 +0,0 @@
-\name{copyPartBaseCPLEX}
-\alias{copyPartBaseCPLEX}
-\alias{CPXcopypartialbase}
-
-\title{
-  Copies a partial basis into an LP problem object.
-}
-
-\description{
-  Low level interface function to the IBM ILOG CPLEX function
-  \code{CPXcopypartialbase}.  Consult the IBM ILOG CPLEX documentation for more
-  detailed information.
-}
-\usage{
-  copyPartBaseCPLEX(env, lp, ncind, cind, cstat, nrind, rind, rstat)
-}
-
-\arguments{
-  \item{env}{
-    An object of class \code{"\linkS4class{cplexPtr}"} as returned by
-    \code{\link{openEnvCPLEX}}. This is basically a pointer to an
-    IBM ILOG CPLEX environment.
-  }
-  \item{lp}{
-    An object of class \code{"\linkS4class{cplexPtr}"} as returned by
-    \code{\link{initProbCPLEX}}. This is basically a pointer to an
-    IBM ILOG CPLEX problem object.
-  }
-  \item{ncind}{
-	An integer that specifies the number of variable or column status values
-	specified.
-  }
-  \item{cind}{
-	A vector that contains the indices of the variables for which status values
-	are being specified.
-  }
-  \item{cstat}{
-	A vector where the ith entry contains the status for variable
-	\code{cind[i]}.
-  }
-  \item{nrind}{
-	An integer that specifies the number of slack, surplus, or artificial status
-	values specified.
-  }
-  \item{rind}{
-	A vector rcnt that contains the indices of the slack, surplus, or artificial
-	variables for which status values are being specified.
-  }
-  \item{rstat}{
-	A vector of where the \code{i}-th entry contains the status for slack,
-	surplus, or artificial \code{rind[i]}.
-  }
-}
-
-\details{
-  Interface to the C function \code{copyPartBase} which calls the CPLEX
-  function \code{CPXcopypartialbase}.
-}
-
-\value{
-  Zero if successful, otherwise nonzero.
-}
-
-\references{
-  The IBM ILOG CPLEX home page at
-  \url{https://www.ibm.com/support/knowledgecenter/SSSA5P}.
-}
-
-\author{
-  Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>
-
-  Maintainer: Mayo Roettger <mayo.roettger@hhu.de>
-}
-
-
-\keyword{ optimize }
diff --git a/src/Makevars.win b/src/Makevars.win
index cd71763f54782d5a021e7371feb1517aab454090..2eea606fd089558d298a5f370a52946b0bfca976 100644
--- a/src/Makevars.win
+++ b/src/Makevars.win
@@ -1,2 +1,2 @@
 PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR}\cplex\include"
-PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex1261
+PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex12100
diff --git a/src/cplexAPI.c b/src/cplexAPI.c
index 283d8cd9eb43e6435920a72bedc46e61e446601f..1518aedfee253e4db6e636f590603dcca893dbcb 100644
--- a/src/cplexAPI.c
+++ b/src/cplexAPI.c
@@ -1,5 +1,5 @@
 /* cplexAPI.c
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
@@ -230,6 +230,17 @@ SEXP initCPLEX(void) {
     tagCPLEXfile        = Rf_install("TYPE_CPLEX_FILE");
     tagCPLEXchannel     = Rf_install("TYPE_CPLEX_CHANNEL");
     tagCPLEXtermination = Rf_install("TYPE_CPLEX_TERMINATION");
+    
+    CPXinitialize();
+    
+    return R_NilValue;
+}
+
+
+/* -------------------------------------------------------------------------- */
+/* call CPLEX finalizer */
+SEXP finalizeCPLEX(void) {
+    CPXfinalize();
     return R_NilValue;
 }
 
@@ -3312,36 +3323,6 @@ SEXP copyBase(SEXP env, SEXP lp, SEXP cstat, SEXP rstat) {
 }
 
 
-/* -------------------------------------------------------------------------- */
-/* copy a partial basis into an LP problem object */
-SEXP copyPartBase(SEXP env, SEXP lp,
-                  SEXP ncind, SEXP cind, SEXP cstat,
-                  SEXP nrind, SEXP rind, SEXP rstat) {
-
-    SEXP out = R_NilValue;
-
-    int *rcind  = INTEGER(cind);
-    int *rrind  = INTEGER(rind);
-    int *rcstat = INTEGER(cstat);
-    int *rrstat = INTEGER(rstat);
-
-    checkEnv(env);
-    checkProb(lp);
-
-    status = CPXcopypartialbase(R_ExternalPtrAddr(env), R_ExternalPtrAddr(lp),
-                                Rf_asInteger(ncind), rcind, rcstat,
-                                Rf_asInteger(nrind), rrind, rrstat
-                               );
-    if (status != 0) {
-        status_message(R_ExternalPtrAddr(env), status);
-    }
-
-    out = Rf_ScalarInteger(status);
-
-    return out;
-}
-
-
 /* -------------------------------------------------------------------------- */
 /* access the basis resident in a problem object */
 SEXP getBase(SEXP env, SEXP lp) {
diff --git a/src/cplexAPI.h b/src/cplexAPI.h
index da268430d5c470adcd7109b8639324c1e8318974..9336d18ea897002de9b40d67aed1fcda3d4df48b 100644
--- a/src/cplexAPI.h
+++ b/src/cplexAPI.h
@@ -1,5 +1,5 @@
 /* cplexAPI.h
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
@@ -71,6 +71,9 @@ SEXP getStatStr(SEXP env, SEXP stat);
 /* initialize cplex */
 SEXP initCPLEX(void);
 
+/* call cplex finalizer */
+SEXP finalizeCPLEX(void);
+
 /* close cplex environment */
 SEXP closeEnv(SEXP env);
 
@@ -375,11 +378,6 @@ SEXP copyStart(SEXP env, SEXP lp,
 /* copy a basis into a problem object */
 SEXP copyBase(SEXP env, SEXP lp, SEXP cstat, SEXP rstat);
 
-/* copy a partial basis into an LP problem object */
-SEXP copyPartBase(SEXP env, SEXP lp,
-                  SEXP ncind, SEXP cind, SEXP cstat,
-                  SEXP nrind, SEXP rind, SEXP rstat);
-
 /* access the basis resident in a problem object */
 SEXP getBase(SEXP env, SEXP lp);
 
diff --git a/src/cplexR.c b/src/cplexR.c
index 83e0eaeadf119a2d9cc9c8deb3954d035b98a3ad..92e246f39c2ae72b2ffec3e10732ddb6836dad8a 100644
--- a/src/cplexR.c
+++ b/src/cplexR.c
@@ -1,5 +1,5 @@
 /* cplexR.c
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/src/cplexR.h b/src/cplexR.h
index 62433817d760add5649ee1dee3456d526c319518..7059ede76d622fff64426cf20f453de726082be9 100644
--- a/src/cplexR.h
+++ b/src/cplexR.h
@@ -1,5 +1,5 @@
 /* cplexR.h
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/src/cplex_checkAPI.c b/src/cplex_checkAPI.c
index 196cc44a412f5ec7d28e0f500d714fce16e28ce0..98c9d8fc9e18dd00ea32d1dfe8e9fbd1931d5715 100644
--- a/src/cplex_checkAPI.c
+++ b/src/cplex_checkAPI.c
@@ -1,5 +1,5 @@
 /* cplex_checkAPI.c
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/src/cplex_checkAPI.h b/src/cplex_checkAPI.h
index 9cec72a55f7b162411b65567ac6b771dae745a74..16422193081a11e7365a10f59f2fb19ed696a2cc 100644
--- a/src/cplex_checkAPI.h
+++ b/src/cplex_checkAPI.h
@@ -1,5 +1,5 @@
 /* cplex_checkAPI.h
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/src/cplex_longparamAPI.c b/src/cplex_longparamAPI.c
index c512edae418da1720125e0aea0c29dfb24229361..575042187c150273643aee0754dc15f166b73ad8 100644
--- a/src/cplex_longparamAPI.c
+++ b/src/cplex_longparamAPI.c
@@ -1,5 +1,5 @@
 /* cplex_longparamAPI.c
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/src/cplex_longparamAPI.h b/src/cplex_longparamAPI.h
index ea419c414108bf169c9cf4fba32c624a0f9e11f7..24bf690307f07d193a7d68d9f9d96d8ca1c39b97 100644
--- a/src/cplex_longparamAPI.h
+++ b/src/cplex_longparamAPI.h
@@ -1,5 +1,5 @@
 /* cplex_longparamAPI.h
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
diff --git a/src/init.c b/src/init.c
index 23c18533c787dc0dcc8a11329d88a69ce4e9521b..a807f504f2a8bbfed7db243ee1517eb96f58c0cd 100644
--- a/src/init.c
+++ b/src/init.c
@@ -1,5 +1,5 @@
 /* init.c
-   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6.
+   R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10.
 
    Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
@@ -40,6 +40,7 @@ static const R_CallMethodDef callMethods[] = {
     {"isCPLEXtermPtr",            (DL_FUNC) &isCPLEXtermPtr,            1},
     {"isNULLptr",                 (DL_FUNC) &isNULLptr,                 1},
     {"initCPLEX",                 (DL_FUNC) &initCPLEX,                 0},
+    {"finalizeCPLEX",             (DL_FUNC) &finalizeCPLEX,             0},
     {"getErrorStr",               (DL_FUNC) &getErrorStr,               2},
     {"getStatStr",                (DL_FUNC) &getStatStr,                2},
     {"closeEnv",                  (DL_FUNC) &closeEnv,                  1},
@@ -134,7 +135,6 @@ static const R_CallMethodDef callMethods[] = {
     {"cleanupCoef",               (DL_FUNC) &cleanupCoef,               3},
     {"copyStart",                 (DL_FUNC) &copyStart,                 8},
     {"copyBase",                  (DL_FUNC) &copyBase,                  4},
-    {"copyPartBase",              (DL_FUNC) &copyPartBase,              8},
     {"getBase",                   (DL_FUNC) &getBase,                   2},
     {"baseWrite",                 (DL_FUNC) &baseWrite,                 3},
     {"readCopyBase",              (DL_FUNC) &readCopyBase,              3},
@@ -270,13 +270,7 @@ static const R_CallMethodDef callMethods[] = {
     {NULL, NULL, 0}
 };
 
-/* -------------------------------------------------------------------------- */
-
 void R_init_cplexAPI(DllInfo *info) {
     R_registerRoutines(info, NULL, callMethods, NULL, NULL);
     R_useDynamicSymbols(info, FALSE);
 }
-
-
-
-