Compiling with Borland C++ Builder 6

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
IGT33
Posts: 2
Joined: Thu, 2004-12-09, 10:15
Contact:

Compiling with Borland C++ Builder 6

#1 Post by IGT33 »

Hi,

Although I've been using dcmtk under Un*x environments for more than a year now, it's the first time I'm using the toolkit under Windows.

So, has anyone successfully compiled (and used) dcmtk on Windows using BCB6? And how, of course.

Thanks in advance,
Gabriel de Dietrich
Image Guided Therapy

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

We recently added some experimental support for Borland C++ (the free 5.5 version). If you insert the following code fragment into the main CMakeLists.txt file, you should be able to use CMake to generate makefiles for Borland:

Code: Select all

# set project wide flags for compiler and linker
IF(CMAKE_CXX_COMPILER MATCHES bcc32)
  # settings for Borland C++
  SET(CMAKE_C_FLAGS "" CACHE STRING "Flags for C compiler." FORCE)
  SET(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Win32 Debug Options C Code" FORCE)
  SET(CMAKE_C_FLAGS_RELEASE "-O2" CACHE STRING "Win32 Release Options C Code" FORCE)
  SET(CMAKE_CXX_FLAGS "" CACHE STRING "Flags used by the compiler during all build types." FORCE)
  SET(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Win32 Debug Options C++ Code" FORCE)
  SET(CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING "Win32 Release Options C++ Code" FORCE)
  SET(CMAKE_STANDARD_LIBRARIES "import32.lib cw32mt.lib" CACHE STRING "Borland C++ Runtime Libraries" FORCE)
ELSE(CMAKE_CXX_COMPILER MATCHES bcc32)
  # settings for Visual C++
  SET(CMAKE_C_FLAGS "/nologo /W3 /GX /Gy /GR- /YX" CACHE STRING "Flags for C compiler." FORCE)
  SET(CMAKE_C_FLAGS_DEBUG "/MTd /Z7 /Od" CACHE STRING "Win32 Debug Options C Code" FORCE)
  SET(CMAKE_C_FLAGS_RELEASE "/MT /O2" CACHE STRING "Win32 Release Options C Code" FORCE)
  SET(CMAKE_CXX_FLAGS "/nologo /W3 /GX /Gy /GR- /YX" CACHE STRING "Flags used by the compiler during all build types." FORCE)
  SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od" CACHE STRING "Win32 Debug Options C++ Code" FORCE)
  SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2" CACHE STRING "Win32 Release Options C++ Code" FORCE)
  SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO" CACHE STRING "Win32 Linker Flags" FORCE)
ENDIF(CMAKE_CXX_COMPILER MATCHES bcc32)
Borland specific settings are already present in the configuration header file (cfwin32.h), so the compilation itself should work. Not much testing has been done with this port yet, though, so don't be too surprised if you run into problems :wink:

IGT33
Posts: 2
Joined: Thu, 2004-12-09, 10:15
Contact:

#3 Post by IGT33 »

Borland specific settings are already present in the configuration header file (cfwin32.h), so the compilation itself should work. Not much testing has been done with this port yet, though, so don't be too surprised if you run into problems :wink:
Thanks. I did a fast first try but, as expected, didn't succeed.

Anyway, it doesn't matter any longer as we are going to switch to MSVC. It seems BCB is being less and less supported even by Borland themselves. :wink:

Thanks again,
Gabriel de Dietrich
Image Guided Therapy

roydobbins
Posts: 25
Joined: Wed, 2005-07-20, 22:42
Location: Payson, Arizona

Borland C++

#4 Post by roydobbins »

For anyone interested, I have compiled DCMTK using the Borland C++ 5.5, compiler (the so called free compiler).

I have run one of the apps (storescu) and it works fine so far.

To get the Borland make files built required a couple of additional tweaks,
so to save anyone else the trouble, I am prepared to post some notes on the procedure followed.

I will be doing some more work with this compiler, and will report on any further findings, as I go along.

Let me know if you need help on this, or would like to incorporate the mods into DCMTK

Irrespective of whether BCB is supported or not, the 5.5 compiler appears to be quite solid, and standards compliant, so I see it as a useful workhorse at the moment, 'till I determine what final requirements emerge

Regards,
Roy

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#5 Post by Marco Eichelberg »

Let me know if you [...] would like to incorporate the mods into DCMTK
In principle, yes, unless they break another supported platform. Please post the patches in this forum. If they become too big, mail them to dicom at offis dot de.

Roko
Posts: 3
Joined: Thu, 2005-09-22, 13:01

#6 Post by Roko »

Hi,

I have compiled DCMTK using the Borland C++ 5.5. My problem is include the library in a simple C++ Builder application. I get the Error:

[Linker Error] Unresolved external '_errno' referenced from F:\_PROJEKTE\NOVIS_VIEWER\_BCB\TEST_DCMTK\DCMTK\DCMDATA\LIBSRC\DCMDATA.LIB|dcistrmf

Regards
Ronny

roydobbins
Posts: 25
Joined: Wed, 2005-07-20, 22:42
Location: Payson, Arizona

Compiling with Borland C++ 5.5

#7 Post by roydobbins »

To fix the linker error:-

_errno not found

go into the file:

config\include\cfwin32.h

in the _BORLANDC section, add:

#define _MT to kick in the multitasking defs for errno

Hope this fixes your problem
Regards,
--Roy

Roko
Posts: 3
Joined: Thu, 2005-09-22, 13:01

Compiling with Borland C++ 5.5

#8 Post by Roko »

Thank you. This fixed my problem.

But now I have an other problem.
The codeguard detected errors in my program (Project1.cgl):

Code: Select all

Error 00001. 0x350010 (Thread 0x00F8):
Resource type mismatch: a(n) object array was expected.
delete[](0x01230004)

Call Tree:
   0x00411ABB(=Project1.exe:0x01:010ABB)
   0x00441CDE(=Project1.exe:0x01:040CDE)
   0x00444D4E(=Project1.exe:0x01:043D4E)
   0x0042F61D(=Project1.exe:0x01:02E61D)
   0x0042418A(=Project1.exe:0x01:02318A)
   0x00428C70(=Project1.exe:0x01:027C70)

The memory block (0x01230004) [size: 802816 bytes] was allocated with malloc
Call Tree:
   0x00413728(=Project1.exe:0x01:012728)
   0x004133D9(=Project1.exe:0x01:0123D9)
   0x00412E2F(=Project1.exe:0x01:011E2F)
   0x00444FB8(=Project1.exe:0x01:043FB8)
   0x00481C68(=Project1.exe:0x01:080C68)
   0x00486650(=Project1.exe:0x01:085650)

------------------------------------------
...
I compiled a simple C++ Builder application:

Code: Select all

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include <dcmimage.h>      /* for DicomImage */

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
  DicomImage *image = new DicomImage("test.dcm");
  if (image != NULL)
  {
    Edit1->Text = "Good!";
  }
  delete image;
}
//---------------------------------------------------------------------------
Regards,
Ronny

roydobbins
Posts: 25
Joined: Wed, 2005-07-20, 22:42
Location: Payson, Arizona

C++ builder

#9 Post by roydobbins »

Sorry I cant help you with this one,

you are compiling and linking with the VCL which is another environment altogether.

another approach to take would be to compile your GUI application independently of the dcmtk, compile the (command line) dcmtk tools, then launch the tool(s) as separate processes, from your application to do the dicom work, and capture the results in your application.

Regards,
--roy

Roko
Posts: 3
Joined: Thu, 2005-09-22, 13:01

Compiling with Borland C++ 5.5

#10 Post by Roko »

Thank you for the idea with the separate process.
But have anyone compile and link the dcmtk in a BCB 5.5 Project?
For example: in a dll?

Regards,
Ronny

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest