CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CodeBase 6.3 [long]



> From: mike.young@wla.com (MIKE YOUNG)

> If you are successful please post it here. I have been looking at trying
> that combination. Have you used CodeBase with any C++ system to date?

I'm assuming you're asking for the instructions for Codebase, not
just whether I'm using it successfully. So, long post follows...
FYI: I got Codebase working just before BCB3 came out. I turned
*off* Incremental Linking in BCB1, and it worked find. Unfortunately,
BCB3 does not have an option to turn off inc. linking. The Sequitur
tech did give me instructions for Codebase with inc. linking on,
but I have not tested it that way, so YMMV.

Everything between the dotted lines was a post of mine to the
borland.public.cppbuilder.database newsgroup.

John Crawford. soma@clark.net

-----------------------------------------------------------
FYI: CodeBase 6.3 *does* work with Borland C++ Builder V1.0,
just to answer my own question <g>. I am putting this here
for archiving in DejaNews, in case anyone else out there
ever uses CodeBase with BCB.

Unfortunately, CodeBase's documentation is even worse than
Borland's :( , at least as far as getting CodeBase to work
with BCB. The manual reads fairly well for *using* CodeBase,
but the installation/usage sections are compiler-specific,
and not only unclear, but incomplete and incorrect, 
contradicting the help I got from Sequiter. So it goes...

I could not get it to work out of the box using the included
instructions, but with lots of email to/from a very helpful
Sequiter technician, it finally worked properly. The text 
below the line is from his email, with some minor editing
and cutting/pasting. Any text in [brackets] are my comments.

Just to note, "worked" means that I declared some CodeBase
variables, and everything compiled, linked, and ran correctly,
for a Windows application. I have not yet created or accessed
a database, or used a DOS console app. YMMV.

NOTE: in the Install process, you *should* install, not only 
BCB, but Borland C++ 5.0 and DLL/Libs (you can skip MSVC++ :) .
There is one file you need that is *only* under the Borland 
C++ 5.0 directory...

*************************************************************

Lester Yung of Sequiter Software Inc.

First, the correct switches must be defined in d4all.h.  Since 
C++ Builder is a 32-bit compiler, S4WIN32 must be defined, and 
the other Operating System switches commented out.  In order to 
use the functions from the CodeBase .dll, you must also define 
S4DLL, and comment out S4STATIC and S4DLL_BUILD.  In addition, 
only one of the three Index Compatibility switches, S4FOX, 
S4MDX, and S4CLIPPER, must be defined. 

[One of S4FOX/S4MDX/S4CLIPPER will be already set, depending
on the option you selected in the InstallShield installation. 
S4DOS is the only OS switch already on, and should be switched
with S4WIN32. "d4all.h" is located in \codebase\cpp\source]

The CodeBase .dll files are located in both \CodeBase\C\DLL32 
and \CodeBase\CPP\DLL32.  There is a different .dll for each 
of the three index types supported by CodeBase.  Although they 
were all originally built as c4dll.dll, they have been renamed 
c4fox.dll, c4mdx.dll, and c4cli.dll, in order to distinguish 
them.  Depending on which Index Compatibility switch you 
defined in d4all.h, you must use the corresponding .dll, 
renamed back to c4dll.dll using your OS's rename command.

[In my case, I installed FoxPro, so I renamed c4fox.dll
to c4dll.dll. It was the only .dll in the directory DLL32]

To use CodeBase in a C++ Builder project, you must add the 
correct header and library files.  [...] using the C++ 
version of CodeBase, then you should include d4all.hpp.  
Because CodeBase is built using 1 byte structure alignment
(compiler option -a1), and C++ Builder uses 4 byte alignment 
by default (compiler option -a4), you should use the 
#pragma pack() directive when including the CodeBase header.
For instance, if you are including d4all.h,then you would 
have the following:

#pragma pack(1)  // packs CodeBase data structs using 1 byte alignment
#include "d4all.h"
#pragma pack() // packs remaining data structs using default alignment

If you are using the C++ version of CodeBase, you will have 
to link with the c4win.lib.  If the CodeBase installation failed 
to put it in the \CodeBase\CPP\BorB directory, then you can 
either use the one found in \CodeBase\CPP\Bor5_32, or build 
one from the DOS prompt using the c4win.bat file and the same 
d4all.h switches as above.

[Yes, the installation failed to put it in the BorB directory,
which is why you should install Borland C++ 5.0, unless you'd
rather build the file yourself... To Link the file, choose
Project->Add to Project, *.lib]

What you add next to your project depends on which linker you 
are using.  By default, C++ Builder uses ILink32, which links 
incrementally.  If you use ILink32, then you must link with 
c4dll.lib, the import library for c4dll.dll.  To obtain 
c4dll.lib, you apply Borland's implib utility to the 
c4dll.dll you are using.  On the other hand, if you use TLink32, 
which links ordinally, then you should add c4ap_win.def to 
your project.  C4ap_win.def is found in both \CodeBase\C\BorB 
and \CodeBase\CPP\BorB.

[I decided to turn off incremental linking, and used TLink. I
don't know if the other method works, but this one did. Again,
do a Project->Add to Project, *.def]

[...] the OS cannot find the c4dll.dll.  There are two ways to
correct this:

1) modify the Windows PATH environment variable to include the 
path to where c4dll.dll is

2) copy or move the c4dll.dll to either the same directory as 
your executable, or to the \Windows\System directory.

[I copied c4dll.dll to my executable directory. Everything ran fine.]

*************************************************************

John Crawford. soma@clark.net

--
"I'm not a fool, Nighthawk."
"Nobody's a fool," he replied. "But you'd be surprised how 
many people can pass for fools when things go wrong."
			Mike Resnick's "Widowmaker Reborn"

---------------------------------------------------------------------------


W Komornicki's Home Page | Main Index | Thread Index