Pelles C forum

C language => Tips & tricks => Topic started by: TimoVJL on August 12, 2017, 08:23:20 AM

Title: Fork of QD (2.3.17) dll
Post by: TimoVJL on August 12, 2017, 08:23:20 AM
Fork of QD (2.3.17) (https://github.com/scibuilder/QD) dll
c_test.c from it & QD.dll & QD.lib import library.

EDIT: missing headers and libs added.
EDIT  QDSSE.dll for 32-bit.
Title: Re: Fork of QD (2.3.17) dll
Post by: jj2007 on August 12, 2017, 04:07:04 PM
That looks very interesting, thanks ;-)

The *.lib files are just import libs. How useful is that, if you need the DLL anyway?
Title: Re: Fork of QD (2.3.17) dll
Post by: TimoVJL on August 12, 2017, 04:11:32 PM
Because it is C++ code, dll is obvious choice.
Title: Re: Fork of QD (2.3.17) dll
Post by: jack on August 13, 2017, 12:43:39 AM
thanks you :)
Title: Re: Fork of QD (2.3.17) dll
Post by: jack on August 13, 2017, 01:20:36 AM
hello TimoVJL
is there a way for you to compile the 32-bit version using sse?,  then you won't have to worry about fpu_fix_start/fpu_fix_end.
I edited the makefile in QD-master\src and added -mfpmath=sse -msse2 to CPPFLAGS = -O2 -mfpmath=sse -msse2
but that's when using gcc, not sure how you would do that in PellesC.
btw, that's a very small-sized dll, only 115k, mine compiled with gcc was 1.2 meg even after stripping.
Title: Re: Fork of QD (2.3.17) dll
Post by: TimoVJL on August 13, 2017, 08:01:16 AM
It was compiled with msvc 2010 with dynamic dlls.
It uses msvcp100.dll.

I added SSE version, with cl option -arch:SSE too.
Title: Re: Fork of QD (2.3.17) dll
Post by: jack on August 13, 2017, 11:23:45 AM
unfortunately it's still using the fpu.
Title: Re: Fork of QD (2.3.17) dll
Post by: jack on August 13, 2017, 01:50:22 PM
TimoVJL, did you have to edit any of the source files in order for vs to compile the project?
I have visual studio 2013-pro and also later community editions but am not able to setup a dll project that will compile
I have an older project, qd-2.3.7 and the 32-bit version compiles ok but if I replace the source files with the newer version then I have problems, something like max is not defined in the namespace std and can't convert qd_read to int.
Title: Re: Fork of QD (2.3.17) dll
Post by: TimoVJL on August 13, 2017, 02:31:30 PM
No.
build cmd attached.
Title: Re: Fork of QD (2.3.17) dll
Post by: jack on August 13, 2017, 03:54:44 PM
thank you
but still the same problem when using vs-2013
Quote
src\qd_real.cpp(446) : error C2039: 'max' : is not a member of 'std'
src\qd_real.cpp(446) : error C2440: '=' : cannot convert from 'qd_real' to 'int'
I have vs-2010 somewhere.
Title: Re: Fork of QD (2.3.17) dll
Post by: TimoVJL on August 13, 2017, 06:27:29 PM
so you have to add
Code: [Select]
#if _MSC_VER >= 18
#include <algorithm>
#endif
to dd_real.cpp and qd_real.cpp
Title: Re: Fork of QD (2.3.17) dll
Post by: jack on August 13, 2017, 06:55:56 PM
you are the man  :)
works like a charm, thank you.
Title: Re: Fork of QD (2.3.17) dd to C
Post by: TimoVJL on August 22, 2017, 06:50:03 PM
Only dd part is partially converted to C, still a lot of errors.
This is for someone who want to develop it further and fix bugs.

Example:
Code: [Select]
#include "c_dd.h"
#pragma comment(lib, "c_dd.lib")

int printf(const char * restrict format, ...);
int puts(const char *string);
// user msg
void c_dd_error(char* msg) { puts(msg); }

int main(void)
{
char buf[200];
double dd[2]; // double-double
c_dd_read("1.234567890", dd);
c_dd_swrite(dd, 10, buf, sizeof(buf));
puts(buf);
return 0;
}

I don't use this code, just test how to convert QD to C