mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: fix C interop example
This commit is contained in:
parent
e399c07a2f
commit
22b4ac2266
@ -1,12 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
// Example of C interop for a very handy task.
|
// Example of C interop for a very handy task.
|
||||||
//
|
//
|
||||||
// wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to
|
// wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to
|
||||||
// render HTML into PDF and various image formats using the Qt WebKit rendering
|
// render HTML into PDF and various image formats using the Qt WebKit rendering
|
||||||
// engine. These run entirely "headless" and do not require a display or display
|
// engine. These run entirely "headless" and do not require a display or display
|
||||||
// service.
|
// service.
|
||||||
//
|
//
|
||||||
// https://github.com/wkhtmltopdf/wkhtmltopdf
|
// https://github.com/wkhtmltopdf/wkhtmltopdf
|
||||||
// https://wkhtmltopdf.org/downloads.html
|
// https://wkhtmltopdf.org/downloads.html
|
||||||
// https://wkhtmltopdf.org/libwkhtmltox/
|
// https://wkhtmltopdf.org/libwkhtmltox/
|
||||||
@ -23,37 +23,37 @@ fn C.wkhtmltopdf_init(use_graphics bool) int
|
|||||||
|
|
||||||
fn C.wkhtmltopdf_deinit() int
|
fn C.wkhtmltopdf_deinit() int
|
||||||
|
|
||||||
fn C.wkhtmltopdf_version() charptr
|
fn C.wkhtmltopdf_version() &char
|
||||||
|
|
||||||
fn C.wkhtmltopdf_create_global_settings() &C.wkhtmltopdf_global_settings
|
fn C.wkhtmltopdf_create_global_settings() &C.wkhtmltopdf_global_settings
|
||||||
|
|
||||||
fn C.wkhtmltopdf_destroy_global_settings(global_settings &C.wkhtmltopdf_global_settings)
|
fn C.wkhtmltopdf_destroy_global_settings(global_settings &C.wkhtmltopdf_global_settings)
|
||||||
|
|
||||||
fn wkhtmltopdf_set_global_setting(global_settings &C.wkhtmltopdf_global_settings, name charptr, value charptr) bool
|
fn wkhtmltopdf_set_global_setting(global_settings &C.wkhtmltopdf_global_settings, name &char, value &char) bool
|
||||||
|
|
||||||
fn C.wkhtmltopdf_create_object_settings() &C.wkhtmltopdf_object_settings
|
fn C.wkhtmltopdf_create_object_settings() &C.wkhtmltopdf_object_settings
|
||||||
|
|
||||||
fn C.wkhtmltopdf_destroy_object_settings(object_settings &C.wkhtmltopdf_object_settings)
|
fn C.wkhtmltopdf_destroy_object_settings(object_settings &C.wkhtmltopdf_object_settings)
|
||||||
|
|
||||||
fn C.wkhtmltopdf_set_object_setting(object_settings &C.wkhtmltopdf_object_settings, name charptr, value charptr) bool
|
fn C.wkhtmltopdf_set_object_setting(object_settings &C.wkhtmltopdf_object_settings, name &char, value &char) bool
|
||||||
|
|
||||||
fn C.wkhtmltopdf_create_converter(global_settings &C.wkhtmltopdf_global_settings) &C.wkhtmltopdf_converter
|
fn C.wkhtmltopdf_create_converter(global_settings &C.wkhtmltopdf_global_settings) &C.wkhtmltopdf_converter
|
||||||
|
|
||||||
fn C.wkhtmltopdf_destroy_converter(converter &C.wkhtmltopdf_converter)
|
fn C.wkhtmltopdf_destroy_converter(converter &C.wkhtmltopdf_converter)
|
||||||
|
|
||||||
fn C.wkhtmltopdf_add_object(converter &C.wkhtmltopdf_converter, object_settings &C.wkhtmltopdf_object_settings, data charptr)
|
fn C.wkhtmltopdf_add_object(converter &C.wkhtmltopdf_converter, object_settings &C.wkhtmltopdf_object_settings, data &char)
|
||||||
|
|
||||||
fn C.wkhtmltopdf_convert(converter &C.wkhtmltopdf_converter) bool
|
fn C.wkhtmltopdf_convert(converter &C.wkhtmltopdf_converter) bool
|
||||||
|
|
||||||
fn C.wkhtmltopdf_http_error_code(converter &C.wkhtmltopdf_converter) int
|
fn C.wkhtmltopdf_http_error_code(converter &C.wkhtmltopdf_converter) int
|
||||||
|
|
||||||
fn C.wkhtmltopdf_get_output(converter &C.wkhtmltopdf_converter, data &charptr) int
|
fn C.wkhtmltopdf_get_output(converter &C.wkhtmltopdf_converter, data &&char) int
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// init
|
// init
|
||||||
init := C.wkhtmltopdf_init(0)
|
init := C.wkhtmltopdf_init(0)
|
||||||
println('wkhtmltopdf_init: $init')
|
println('wkhtmltopdf_init: $init')
|
||||||
version := C.wkhtmltopdf_version()
|
version := int(C.wkhtmltopdf_version())
|
||||||
println('wkhtmltopdf_version: $version')
|
println('wkhtmltopdf_version: $version')
|
||||||
global_settings := C.wkhtmltopdf_create_global_settings()
|
global_settings := C.wkhtmltopdf_create_global_settings()
|
||||||
println('wkhtmltopdf_create_global_settings: ${voidptr(global_settings)}')
|
println('wkhtmltopdf_create_global_settings: ${voidptr(global_settings)}')
|
Loading…
Reference in New Issue
Block a user