Setting up your project (non-C environments)

As mentioned, ITLogLib/Win32 is basically a standard (32bit) Windows DLL (file name: "ITLogLib2Win32.dll"), and the declarations of its interface in C form can be found in the file "ITLogLib2Win32.h" (see What ITLogLib/Win32 consists of). The exported functions use the Windows standard calling convention, so for instance the QuickLog() function is effectively declared in "ITLogLib2Win32.h" as follows:

 

void __stdcall QuickLog(

const char* szModuleStr, const char* szCaseStr, const char* szText);

 

Besides the exported functions, there are the ITLogLevel constants. They are declared as follows:

 

typedef enum {

LEVEL_INFO= 1, LEVEL_WARNING= 2, LEVEL_ERROR= 4, LEVEL_ALARM= 8

} ITLogLevel;

 

So to use ITLogLib/Win32 in non-C environments, there are typically the following steps:

 

1.    Find out if your environment can call functions exported by Windows DLLs.

If not, that's a bad situation. Then you could check if you can use another ITLogLib variant (which you should already have done) or if you can wrap a ITLogLib variant in a form which can be used by your environment. See
Which ITLogLib variants do exist? and Which ITLogLib variant should I use?. You can also contact us if the problems remain.

2.    Find out the exact procedure for using a Windows DLL in your enviroment. Usually there are two main ways:

a)    By manually declaring the functions:

In most environments you have to declare the functions of the DLL yourself to be able to call them. At runtime your environment then usually loads the DLL when it is needed. Sometimes you also have to explicitely load the DLL at runtime with a special statement.

Examples:

·      In Visual Basic 6 and Visual Basic for Applications (VBA) (e.g., Word Basic, Access Basic) you would place declarations as the following ones in a module (but of course you should not use ITLogLib/Win32 in these environments but use ITLogLib/COM):

 

Const LEVEL_INFO As Integer = 1

Const LEVEL_WARNING As Integer = 2

Const LEVEL_ERROR As Integer = 4

Const LEVEL_ALARM As Integer = 8

 

Declare Sub QuickLog Lib "ITLogLib2Win32.dll" (ByVal ModuleStr As String, ByVal CaseStr As String, ByVal Text As String)

 

At runtime then you need no special statement to load the DLL.

 

·      In Delphi (here of course you should use ITLogLib/Delphi or ITLogLib/COM instead of ITLogLib/Win32) you would write:

 

const

LEVEL_INFO = $00000001;

LEVEL_WARNING = $00000002;

LEVEL_ERROR = $00000004;

LEVEL_ALARM = $00000008;

 

procedure QuickLog(Module: PChar; sCase: PChar; Text: PChar);

stdcall; external 'ITLogLib2Win32.dll';

 

Here again you need no special statement at runtime to load the DLL.

 

b)    By linking to an import library:

 

In some environments the DLL function calls in your programs must be linked at build-time to a static library which then at runtime forwards the calls to the DLL. This static library is usually called an import library and the environment should be able to generate the import libraries for DLLs in the static library format it requires. Often this is done using a special import tool.

As mentioned and as under "a)", at runtime the DLL is still needed and loaded. That's why the linkage established at build-time is usually called a "dynamic" linkage.

Example:

This way is how it is done in the conventional C environments. See Setting up your project.