Move C++ API over to function tables rather than linking libRS directly.

Change-Id: I7841df768d5bd10fa941b3655673fd73496a8137
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index be011aa..fcc5fc5 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -24,6 +24,8 @@
 #include "RefBase.h"
 #endif
 
+#include "rsDispatch.h"
+
 // Every row in an RS allocation is guaranteed to be aligned by this amount
 // Every row in a user-backed allocation must be aligned by this amount
 #define RS_CPU_ALLOCATION_ALIGNMENT 16
@@ -62,7 +64,13 @@
 
     void finish();
 
+    static dispatchTable* dispatch;
+
  private:
+    static void* librs;
+
+    static bool initDispatch(int targetApi);
+
     bool init(int targetApi, bool forceCpu, bool synchronous);
     static void * threadProc(void *);
 
@@ -78,6 +86,7 @@
 
     ErrorHandlerFunc_t mErrorFunc;
     MessageHandlerFunc_t mMessageFunc;
+    bool mInit;
 
     struct {
         Element *U8;