digitalmars.D.learn - exe outputs 0x00 to 0xFF
- Daniel919 (28/28) May 15 2007 Hi, I am trying to get fltk2 working for D on Windows.
- Bill Baxter (6/37) May 15 2007 As I mentioned in the bugs newsgroup, you can't just link D code to C++
Hi, I am trying to get fltk2 working for D on Windows.
I compiled fltk2 with dmc, which results in fltk2.lib.
For testing the .lib I compiled one of the examples (from C:\fltk-2.0\test)
with:
dmc hello.cxx -I "C:\fltk-2.0" "C:\fltk-2.0\lib\fltk2.lib"
"C:\dm\lib\gdi32.lib" "C:\dm\lib\ole32.lib" "C:\dm\lib\uuid.lib"
"C:\dm\lib\comctl32.lib" "C:\dm\lib\wsock32.lib" "C:\dm\lib\shell32.lib"
"C:\dm\lib\advapi32.lib"
No errors/warnings on compiling, hello.exe is working as expected.
Now the same for dmd (nearly the same command line):
fltktest.d--------------------
module fltktest;
void main () {
}
------------------------------
dmd fltktest.d "C:\fltk-2.0\lib\fltk2.lib" "C:\dm\lib\gdi32.lib"
"C:\dm\lib\ole32.lib" "C:\dm\lib\uuid.lib" "C:\dm\lib\comctl32.lib"
"C:\dm\lib\wsock32.lib" "C:\dm\lib\shell32.lib" "C:\dm\lib\advapi32.lib"
No errors/warnings on compiling, but fltktest.exe outputs:
0x00000000, // 0x00
0xff000000, // 0x01
0x00ff0000, // 0x02
0xffff0000, // 0x03
AND SO ON, UP TO
0xffdaff00, // 0xfe
0xffffff00
dmd fltktest.d without linking in the .lib results in a correct .exe.
Any idea ?
May 15 2007
Daniel919 wrote:
Hi, I am trying to get fltk2 working for D on Windows.
I compiled fltk2 with dmc, which results in fltk2.lib.
For testing the .lib I compiled one of the examples (from C:\fltk-2.0\test)
with:
dmc hello.cxx -I "C:\fltk-2.0" "C:\fltk-2.0\lib\fltk2.lib"
"C:\dm\lib\gdi32.lib" "C:\dm\lib\ole32.lib" "C:\dm\lib\uuid.lib"
"C:\dm\lib\comctl32.lib" "C:\dm\lib\wsock32.lib" "C:\dm\lib\shell32.lib"
"C:\dm\lib\advapi32.lib"
No errors/warnings on compiling, hello.exe is working as expected.
Now the same for dmd (nearly the same command line):
fltktest.d--------------------
module fltktest;
void main () {
}
------------------------------
dmd fltktest.d "C:\fltk-2.0\lib\fltk2.lib" "C:\dm\lib\gdi32.lib"
"C:\dm\lib\ole32.lib" "C:\dm\lib\uuid.lib" "C:\dm\lib\comctl32.lib"
"C:\dm\lib\wsock32.lib" "C:\dm\lib\shell32.lib" "C:\dm\lib\advapi32.lib"
No errors/warnings on compiling, but fltktest.exe outputs:
0x00000000, // 0x00
0xff000000, // 0x01
0x00ff0000, // 0x02
0xffff0000, // 0x03
AND SO ON, UP TO
0xffdaff00, // 0xfe
0xffffff00
dmd fltktest.d without linking in the .lib results in a correct .exe.
Any idea ?
As I mentioned in the bugs newsgroup, you can't just link D code to C++
code. Even using the DMD/DMC combo, the D and C++ ABIs are
incompatible. Using DMD/DMC you can however call functions in C
libraries directly from D by declaring the functions as "extern(C)" in D.
--bb
May 15 2007








Bill Baxter <dnewsgroup billbaxter.com>