Btrieve 2
Loading...
Searching...
No Matches
Using Btrieve with Perl

Using Btrieve with Perl on Windows x64

Documented below is one approach to configuring the Btrieve 2 SDK for the Perl 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 and Perl if not already installed.
  • Install the Btrieve 2 Windows SDK for Zen.
  • Generate, build, and install Btrieve Perl.
    • Open the Visual Studio x64 Native Tools Command Prompt.
    • Change directory into the Btrieve 2 SDK directory.
    • Generate Btrieve Perl.
      • c:\swigwin-3.0.12\swig.exe -cppext cpp -outcurrentdir -perl5 -c++ -Iinclude swig\btrievePerl.swig
        • Note that the path to SWIG used above may differ.
        • Note that Perl version 5 is specified.
    • Build Btrieve Perl.
      • cl -EHsc -c -Iinclude -DWIN32 -IC:\Strawberry\perl\lib\CORE btrievePerl_wrap.cpp
        • Note that the path to Perl used above may differ.
        • You may need to modify the Perl installation's configuration to get a clean compile. This is not a SWIG issue but a Perl issue.
      • link -dll win64\x86_64\btrieveCpp.lib -libpath:C:\Strawberry\perl\lib\CORE libperl528.a -out:btrievePerl.dll btrievePerl_wrap.obj
        • Note that the path to Perl used above may differ.
    • Install Btrieve Perl.
      • copy btrievePerl.pm "c:\Program Files\Actian\Zen\bin"
      • copy btrievePerl.dll "c:\Program Files\Actian\Zen\bin"
        • You may need elevated permissions to perform these copies.
    • Execute the Btrieve Perl sample program.
      • c:\Strawberry\perl\bin\perl.exe samples\btest.pl 9
        • You should see the output "record: (9, 81, 3)".
        • Note that the path to Perl used above may differ.
        • You may need to change the permissions of the current directory if you receive the error "Error: BtrieveClient->FileCreate:94:Permission error at samples\btest.pl line 50.".

Using Btrieve with Perl on Ubuntu 20 x64

Documented below is one approach to configuring the Btrieve 2 SDK for the Perl programming language. In this example, we will use the Perl package to target an Ubuntu 20 x64 environment. It is assumed that Zen is already installed and running.

  • Install SWIG and Perl if not already installed.
    • Open a terminal window as a non-"root" user.
    • sudo apt install swig
    • sudo apt install perl
  • Install the Btrieve 2 Linux SDK for Zen.
  • Generate, build, and install Btrieve Perl.
    • Open a terminal window as a non-"root" user.
    • Change directory into the Btrieve 2 SDK directory.
    • Generate Btrieve Perl.
      • swig -cppext cpp -outcurrentdir -perl5 -c++ -Iinclude swig/btrievePerl.swig
        • Note that Perl version 5 is specified.
    • Build Btrieve Perl.
      • g++ -c -fPIC -Iinclude -I/usr/lib/x86_64-linux-gnu/perl/5.30.0/CORE btrievePerl_wrap.cpp
        • Note that the path to Perl used above may differ.
      • g++ -shared btrievePerl_wrap.o -o btrievePerl.so -L/usr/local/actianzen/lib64 -lbtrieveCpp
    • Install Btrieve Perl.
      • sudo cp btrievePerl.pm /usr/local/actianzen/lib64
      • sudo cp btrievePerl.so /usr/local/actianzen/lib64
    • Execute the Btrieve Perl sample program.
      • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/actianzen/lib64
      • perl samples/btest.pl 9
        • You should see the output "record: (9, 81, 3)".
        • You may need to change the permissions of the current directory if you receive the error "Error: BtrieveClient->FileCreate:94:Permission error at samples\btest.pl line 50.".