using wkhtmltopdf with D

Dr.No jckj33 at gmail.com
Mon May 28 01:28:10 UTC 2018


I'm trying to use wkhtmltopdf[1] with D. I converted this 
header[2] with little modification using htod tool which resulted 
in this[3].
The libray is passed to link using:

pragma(lib, "wkhtmltox.lib");
(that file is in wkhtmltopdf\lib folder)


and the module imported with:
import pdf;

but it crashes right upon the start with a SEGFAULT:

void main()
{
	
	wkhtmltopdf_global_settings * gs;
	wkhtmltopdf_object_settings * os;
	wkhtmltopdf_converter * c;
	
	/* Init wkhtmltopdf in graphics less mode */
	wkhtmltopdf_init(0);
}

toolset I'm using:

DUB version 1.8.1, built on Apr 29 2018
LDC - the LLVM D compiler (1.9.0):
   based on DMD v2.079.1 and LLVM 5.0.1
   built with LDC - the LLVM D compiler (1.9.0)
   Default target: i686-pc-windows-msvc
   Host CPU: skylake
   http://dlang.org - http://wiki.dlang.org/LDC

What's likely the reason of the crash? mismatch between D and C 
memory alignment?

[1]: https://wkhtmltopdf.org/index.html
[2]: 
https://github.com/clowder/wkhtmltopdf/blob/master/src/lib/pdf.h
[3]: https://pastebin.com/SrtDUhPf


More information about the Digitalmars-d-learn mailing list