FLTK logo

STR #2014

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | SVN ⇄ GIT ]

STR #2014

Application:FLTK Library
Status:2 - Closed w/o Resolution
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:2 - Specific to an operating system
Subsystem:Core Library
Summary:Digital Mars C++ support for FLTK 1.3
Version:1.4-feature
Created By:effelsberg
Assigned To:AlbrechtS
Fix Version:Will Not Fix
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text  
 
#1 effelsberg
05:20 Jul 28, 2008
|=---=[ Digital Mars C++ support for FLTK 1.3
I know, the last thing you need is support for yet another compiler, especially
if I look at the current poll. Nevertheless, Matthias started a D port of
FLTK a while ago. D is from Walter Bright who is also the man behind the
Digital Mars C++ compiler, so that's the link.
Also, there's another FLTK/D library named fltk4d, a D wrapper around a
C wrapper around FLTK, that relies on a DLL created by ... well ...
a different compiler suite. Wouldn't it be great to have Digital Mars at
both ends (thus allowing static libraries, btw)?

There are only a few source code changes to be done, based on
fltk-1.3.x-r6148.
dmc is Version 8.50 (for tracking of compiler bugs).


|=---=[ src/Fl_Help_View.cxx, line 74 and src/filename_absolute.cxx, line 42:
# if !defined(__DMC__)
#  define getcwd _getcwd
# endif


|=---=[ FL/Fl_Pixmap.H, line 60:
For some reason, dmc doesn't like the extra non-const parameterized
version of some functions / constructors.
#if !defined(__DMC__)
  explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
#endif


|=---=[ FL/fl_draw.H, line 186:
#if !defined(__DMC__)
FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
#endif

Question:
Is there any need to specify these non-const versions at all?


|=---=[ src/fl_draw_pixmap.cxx:
Enclose implementations of the above functions in similar #defines.


|=---=[ src/screen_xywh.cxx:
Replace every occurance (3) of
    #ifdef WIN32
with
    #if defined(WIN32) && !defined(__DMC__)


|=---=[ src/Fl_win32.cxx:
line 79:
#if !defined(__GNUC__) && !defined(__DMC__)
#  define USE_TRACK_MOUSE
#endif // !__GNUC__ && !__DMC__

Note:
The (binary) library of DMC includes _TrackMouseEvent, it's just missing
entries in the header that deny access.
Instead of disabling mouse tracking, you can add at the top of the header
(or in DMCs comctrl.h, where it belongs):
#ifdef __DMC__
#define TME_LEAVE       0x00000002
typedef struct tagTRACKMOUSEEVENT {
    DWORD cbSize;
    DWORD dwFlags;
    HWND  hwndTrack;
    DWORD dwHoverTime;
} TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT;
WINUSERAPI BOOL WINAPI _TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack);
#endif

line 633 (add):
#if defined(__DMC__)
// Attention: 32bit only for dmc
typedef UINT UINT_PTR;
#endif


|=---=[ About: Warning 7: possible extraneous ';'
This warning appears when empty for loops are written with no space or
something else between the closing bracket and the semicolon:
    for(...);
Maybe change such lines to:
    for(...) /* tunix */ ;
or supply -w7 on the command line to suppress warning 7.

<interlude>
Facts for the geeks:
The term "tunix" appears in one of the Simon the Sorcerer adventures (at least
in the German edition), it's called the "programmer's standard excuse". I don't
know how much "tunix" is understood in native English, in German it means
"do nothing".
</interlude>


|=---=[ About: Warning 2: possible unintended assignment
This warning appears, if a test contains only a = sign. This is legal and
very tight programming, but dmc recognizes that this can be a potential bug.
To get rid of these warnings rewrite such lines:
    if ((x = boxnumber(value))) ...
to:
    if ((x = boxnumber(value)) != 0) ...
or supply -w2 on the command line to suppress warning 2.


|=---=[ png/pngconf.h, line 1443
#    if defined(_MSC_VER) || defined(__DMC__)
#      define png_snprintf _snprintf   /* Added to v 1.2.19 */
#      define png_snprintf2 _snprintf
#      define png_snprintf6 _snprintf
#    else
#      define png_snprintf snprintf   /* Added to v 1.2.19 */
#      define png_snprintf2 snprintf
#      define png_snprintf6 snprintf
#    endif


|=---=[ fluid/FL_Window_Type.cxx, in Fl_Widget_Class_Type::make()
DMC bug: dmc cannot cast a class pointer implicitly to a
private base class pointer.
Remedy: Write explicit casts.
line 1410:
  //myo->factory = this;  // implicit cast to a private base class pointer
  myo->factory = (Fl_Type*)this;
line 1414:
  w->window = (Fl_Window_Type*)myo;
line 1421:
  return (Fl_Type*)myo;


|=---=[ Making (still the dirty part)
Note: The guides for making the library are based on msys/make,
not the make that comes with Digital Mars.
(I admit, an inconsitency in style.)
The files can be greatly simplified, because they support much tasks that
don't apply to dmc. My intention here is to make existing templates
working for dmc.


|=---=[ General - Suffixes
The standard suffixes for objects and libraries are .obj and .lib.
Rename every suffix in makeinclude and the Makefiles accordingly.


|=---=[ General - Path separator
Most of the time the unix path separator / is understood.
The backslash (double \\ in GNU Makefiles) is especially needed when
the linker is involved.


|=---=[ General - Naming libraries for linking
There's no option like -l or -L for dmc. Address libraries with their name.
Installed system libraries:
        ole32.lib
Libraries with relative path (with double \\ in Makefile):
        ..\\lib\\libfltk.lib
Libraries plus separate relative Path:
dmc seems to have no option to directly supply a user library path, but
there's a trick I discovered.
gcc's
        -L../lib
translates to
        ..\\lib\\.lib


|=---=[ General - Using DM make
DM make is not as powerful as GNU make. I didn't play much with it,
but one important limitation I found is missing functions.
E.g. you cannot replace suffixes in this way:
OBJECTS = $(CPPFILES:.cxx=.obj)
You have to write your own list of OBEJCTS in this case.


|=---=[ makeinclude
makeinclude is copied from makefiles/makeinclude.mingw and modified:
CXX = dmc.exe
CC = dmc.exe
OPTIM =
CFLAGS =
CXXFLAGS =
LIBCOMMAND = lib.exe -c
LIBEXT = .lib
RANLIB = :
LDLIBS = ole32.lib uuid.lib comctl32.lib wsock32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib


|=---=[ config.h
config.h is copied from makefiles/makeinclude.mingw, some defines are removed:
//#define HAVE_VSNPRINTF 1
//#define HAVE_SNPRINTF 1
//#define HAVE_STRINGS_H 1


|=---=[ src/Makefile
Changes (no GL, no dynamic libs):
all: $(LIBNAME) $(FLLIBNAME) $(IMGLIBNAME)


|=---=[ test/Makefile
Since dmc doesn't currently support GL out of the box, remove the references
to the GL demos.
#all: $(ALL) $(GLDEMOS)
all: $(ALL)


|=---=[ Nor for real: Make it
cd into every subdirectory and make it.
Hint for all those with dual cores: Try
    make -j2
to let (GNU) make start two compiler instances at once.
Yeah, that's why we have dual cores!
 
 
#2 AlbrechtS
12:20 Jan 15, 2023
What is the status of this STR, and what is the status of the Digital Mars C++ compiler (DMC)?

Looking at the old (and certainly outdated) patch instructions, this doesn't seem to be easily doable. At least I wouldn't want to change Makefiles. It would be different if the compiler would be supported by CMake and we'd have to make only minimal source code changes.

Is the OP still interested?
 
 
#3 effelsberg
15:48 Jan 19, 2023
Nice assertion that computers are good at remembering things.

Back then, DMC was a Fast Light C++ Compiler (what a qualifier!) with some quirks, but hey, which compiler didn't have some? I wouldn't recommend DMC nowadays for the obvious reasons but rather one of the distros like TDM-GCC (my choice) or the ones from Stephan Lavavej or Chris Wellons.

No need to keep this STR alive.
 
 
#4 AlbrechtS
17:44 Jan 19, 2023
Hi Stephan, thanks for replying.

I'm closing this STR now.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.