Using Delphi library with C++ Builder

| category: Programming | author: st
Tags: ,

Since early XE versions C++ Builder supports Delphi units directly added in C++ project and compiles them as well as C/C++ source. However, this approach has several drawbacks:

  • Usually, Delphi files are stored in separated folders of other applications and packages. So your C++ project will point to many …

Installing Delphi 7 on Windows 7/8/10/Server 2012

| category: Programming | author: st
Tags:

How to install and use Delphi 7 and help files on Windows 8/10 or Server 2012.

Installation

Start Delphi setup and install all required items including help files.

In Windows 8/10/Server 2012 or later (should work on Windows 7 too):

  • Create the shortcut to Delphi32.exe
  • Open …

Interface implementations and multiple inheritance in C++

| category: Programming | author: st
Tags:

Multiple inheritance of interfaces which are pure abstract classes indeed is not a problem until you need to use the interface implementation in other classes.

Suppose there are two interfaces, the implementation of which will be used in other classes.

class IA
{
public:
    virtual void m1() = 0;
};

class IB : public …

Crack C# namespaces in 30 seconds

| category: Programming | author: st
Tags:

The namespaces conception in C# seems to be exhaustive and insufficient at the same time compared with a strong module notation in Oberon-2 and even with a modular programming approaches in Free Pascal/Delphi.

Why insufficient? You cannot declare constants and functions within namespaces but you should add a class …

Firebird: bulk insert and bulk export

| category: Programming | author: st
Tags:

Firebird doesn't support INSERT BULK command or bcp.exe utility. But the external tables can be a good replacement. Simple example is below.

Check that firebird.conf file allow to create external tables. Write or uncomment line like

ExternalFileAccess = Full

Create external table

CREATE TABLE BCP_DATA EXTERNAL FILE 'с:\temp …

Delphi/Free Pascal: very simple "old school" mutex

| category: Programming | author: st
Tags: ,

The code below show how to implement very simple but cross-platform "old school" mutex (mutually exclusive semaphore)

interface

type
  TMutex = class
  private
    FFileHandle: integer;
  public
    constructor Create(const AName: string; const WaitForMSec: integer = 10000);
    destructor Destroy; override;
  end;

implementation

uses
  Classes, SysUtils, DateUtils,
  {$IFDEF MSWINDOWS}
  Windows
  {$ENDIF};

function GetTempDir: string …