Using Btrieve with C# on Windows x64
Documented below is one approach to configuring the Btrieve 2 SDK for the C# programming language. In this example, we will use Visual Studio 2015 to target a native Windows x64 environment. It is assumed that Zen is already installed and running.
-
Install SWIG if not already installed.
-
Install the Btrieve 2 Windows SDK for Zen.
-
Generate, build, and install Btrieve C#.
-
Open the Visual Studio x64 Native Tools Command Prompt.
-
Change directory into the Btrieve 2 SDK directory.
-
Generate Btrieve C#.
-
c:\swigwin-3.0.12\swig.exe -cppext cpp -outcurrentdir -csharp -namespace Actian.Data.Zen -outfile btrieveCSharp.cs -c++ -Iinclude -o btrieveCSharp.cpp swig\btrieveCSharp.swig
-
Note that the path to SWIG used above may differ.
-
Build Btrieve C#.
-
cl -EHsc -c -Iinclude btrieveCSharp.cpp
-
link -dll win64\x86_64\btrieveCpp.lib btrieveCSharp.obj
-
Install Btrieve C#.
-
copy btrieveCSharp.cs "c:\Program Files\Actian\Zen\bin"
-
copy btrieveCSharp.dll "c:\Program Files\Actian\Zen\bin"
-
You may need elevated permissions to perform this copy.
-
Build and execute the Btrieve C# sample program.
-
csc samples\btest.cs "c:\Program Files\Actian\Zen\bin\btrieveCSharp.cs"
-
.\btest.exe 9
-
You should see the output "record: (9, 81, 3)".
-
You may need to allow everyone to write to the current directory if you receive the error "Error: BtrieveClient.FileCreate(): STATUS_CODE_PERMISSION_ERROR:Permission error".
Using Btrieve with C# on Ubuntu Linux x64
Documented below is one approach to configuring the Btrieve 2 SDK for the C# programming language. In this example, we will target an Ubuntu Linux x64 environment. It is assumed that Zen is already installed and running.
-
Install SWIG and Mono if not already installed.
-
sudo apt install swig
-
sudo apt install mono-mcs
-
Install the Btrieve 2 Linux SDK for Zen.
-
Generate, build, and install Btrieve C#.
-
Open a Terminal window.
-
Change directory into the Btrieve 2 SDK directory.
-
Generate Btrieve C#.
-
swig -cppext cpp -outcurrentdir -csharp -namespace Actian.Data.Zen -outfile btrieveCSharp.cs -c++ -Iinclude -o btrieveCSharp.cpp swig/btrieveCSharp.swig
-
Build Btrieve C#.
-
g++ -c -fPIC -Iinclude btrieveCSharp.cpp
-
g++ -shared btrieveCSharp.o -o libbtrieveCSharp.so -L/usr/local/actianzen/lib64 -lbtrieveCpp
-
Install Btrieve C#.
-
sudo cp btrieveCSharp.cs /usr/local/actianzen/lib64
-
sudo cp libbtrieveCSharp.so /usr/local/actianzen/lib64
-
Build and execute the Btrieve C# sample program.
-
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/actianzen/lib64
-
mcs samples/btest.cs /usr/local/actianzen/lib64/btrieveCSharp.cs -out:btest
-
./btest 9
-
You should see the output "record: (9, 81, 3)".
-
You may need to allow everyone to write to the current directory if you receive the error "Error: BtrieveClient.FileCreate(): STATUS_CODE_PERMISSION_ERROR:Permission error".