Using Node.js with Caché - InterSystems Documentation
Using Node.js with Caché - InterSystems Documentation
Using Node.js with Caché - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Building cache.node from Source<br />
Create this text file and modify it to suite your own environment. There is just one path that will require modifying for your<br />
local environment<br />
• The compiler options line (obj.cxxflags):<br />
"-I/cache20102/dev/cpp/include"<br />
This must be the directory where the <strong>Caché</strong> C header files reside (For example: callin.h)<br />
A.1.2 Build the cache.node Module<br />
In the directory containing both the wscript file created previously and the source code (cache.cpp) use the node-waf<br />
command to build the module:<br />
node-waf configure build<br />
If successful, the output will look something like the following:<br />
Setting srcdir to<br />
: /opt/cm/node042<br />
Setting blddir to<br />
: /opt/cm/node042/build<br />
Checking for program g++ or c++<br />
: /usr/bin/g++<br />
Checking for program cpp<br />
: /usr/bin/cpp<br />
Checking for program ar<br />
: /usr/bin/ar<br />
Checking for program ranlib<br />
: /usr/bin/ranlib<br />
Checking for g++<br />
: ok<br />
Checking for node path<br />
: not found<br />
Checking for node prefix<br />
: ok /opt/cm/node042<br />
'configure' finished successfully (0.974s)<br />
Waf: Entering directory `/opt/cm/node042/build'<br />
[1/2] cxx: cache.cpp -> build/default/cache_1.o<br />
[2/2] cxx_link: build/default/cache_1.o -> build/default/cache.node<br />
Waf: Leaving directory `/opt/cm/node042/build'<br />
'build' finished successfully (2.904s)<br />
root@ubuntu:/opt/cm/node042#<br />
The <strong>Caché</strong> module will be created: cache.node<br />
This module will, by default, be created in the following subdirectory:<br />
.../build/default/<br />
A.2 Building Directly from Source<br />
As an alternative to using the scripted infrastructure provided by the <strong>Node</strong>.<strong>js</strong> Group, the <strong>Caché</strong> module (cache.node) can<br />
be built directly from the C++ source code as follows:<br />
Linux:<br />
g++ -c -g -fPIC -DPIC -DEV_MULTIPLICITY=0 –DLINUX \<br />
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall \<br />
-I/opt/local/node/include/node -I/cache20102/dev/cpp/include \<br />
-o cache.o cache.cpp<br />
g++ -shared -L/opt/local/node/lib -Wl -lpthread -lrt -ldl -lc -lm \<br />
-o cache.node cache.o<br />
Note the three paths that will require modifying to suit your local environment.<br />
• Path to the <strong>Node</strong>.<strong>js</strong> C/C++ header files. For example:<br />
/opt/local/node/include/node<br />
• Path to the <strong>Caché</strong> C/C++ header files. For example:<br />
/cache20102/dev/cpp/include<br />
38 <strong>Using</strong> <strong>Node</strong>.<strong>js</strong> <strong>with</strong> <strong>Caché</strong>