Giter VIP home page Giter VIP logo

hblibxlsxwriter's Introduction

hblibxlsxwriter

libxlsxwriter wrappers for Harbour

Libxlsxwriter can be found here: https://github.com/jmcnamara/libxlsxwriter

You will need the include files from libxlsxwriter sources to create the lib.

  • Create the lib using libxlw.hbp:

    hbmk2 libxlw.hbp

  • Then try the examples:

    hbmk2 demo.prg example.hbp

hblibxlsxwriter's People

Contributors

ftrautwein avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hblibxlsxwriter's Issues

Compile&run on linux

I am trying compile and use this nice wrapper on linux. All test for library libxlsxwriter passed clean.
I can compile wrapper after small changes in source code (lower, case and dll->so, adding xhb.hbc to libxlw.hbp):
[jan@ hblibxlsxwriter]$ diff hblibxlsxwriter.prg hblibxlsxwriter.prg.new
17,18c17,18
#include "CStruct.ch" // required for "typedef struct"
#include "Wintypes.ch"
#include "cstruct.ch" // required for "typedef struct"
#include "wintypes.ch"
23c23,24
nHDll:= hb_libLoad( "libxlsxwriter.dll" )
nHDll:= hb_libLoad( "libxlsxwriter.so" )
But running is SIGSEGV in
lxw_workbook_close (lxw_format_get_xf_index (self=0x4034000000000000) at format.c:265).

If I set format to NULL in library code (src/worksheet.c), program demo.p
demo.prg.txt

rg runs correctly and xlsx file is created (missing formats visibly affect only date values):
diff --git a/src/worksheet.c b/src/worksheet.c
index d8e8752..3b10416 100644
--- a/src/worksheet.c
+++ b/src/worksheet.c
@@ -4547,6 +4547,7 @@ worksheet_set_column_opt(lxw_worksheet *self,
lxw_col_t col;
lxw_error err;

  • format = NULL;
    if (user_options) {
    hidden = user_options->hidden;
    level = user_options->level;

Here is gdb and valgrind output for run demo.prg. My knowledge ends here. Can you look at it?
thank you for your good work
GDB
[jan@ example]$ hbmk2 -b demo.prg example.hbp
Harbour 3.4.0dev (3eae9a6254) (2017-03-31 08:48)
Copyright (c) 1999-2017, https://github.com/vszakats/harbour-core/
Compiling 'demo.prg'...
Lines 541, Functions/Procedures 1
Generating C source output to '/tmp/hbmk_dqua5f.dir/demo.c'... Done.
[jan@ example]$ gdb demo
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from demo...done.
(gdb) r
Starting program: /usr/local/src/hbvs/hblibxlsxwriter/example/demo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
lxw_format_get_xf_index (self=0x4034000000000000) at format.c:265
265 if (self->xf_index != LXW_PROPERTY_UNSET) {
(gdb)
VALGRIND
[jan@ example]$ valgrind ./demo
==18860== Memcheck, a memory error detector
==18860== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==18860== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==18860== Command: ./demo
==18860==
==18860== Invalid read of size 4
==18860== at 0x9D55DDA: lxw_format_get_xf_index (format.c:265)
==18860== by 0x9D69953: _worksheet_write_col_info (worksheet.c:2717)
==18860== by 0x9D69953: _worksheet_write_cols (worksheet.c:2785)
==18860== by 0x9D69953: lxw_worksheet_assemble_xml_file (worksheet.c:3340)
==18860== by 0x9D798F7: _write_worksheet_files (packager.c:178)
==18860== by 0x9D798F7: lxw_create_package (packager.c:894)
==18860== by 0x9D75056: workbook_close (workbook.c:1557)
==18860== by 0x57DDC11: hb_dynCall (hbdyn.c:956)
==18860== by 0x57D27E1: HB_FUN_HB_DYNCALL (hbdynhb.c:113)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DD8E8: hb_vmMacroFunc (hvm.c:5704)
==18860== by 0x58DD8E8: hb_vmExecute (hvm.c:2640)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DDF70: hb_vmExecute (hvm.c:1756)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DC2B9: hb_vmExecute (hvm.c:1769)
==18860== Address 0x4034000000000018 is not stack'd, malloc'd or (recently) free'd
==18860==
==18860==
==18860== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==18860== General Protection Fault
==18860== at 0x9D55DDA: lxw_format_get_xf_index (format.c:265)
==18860== by 0x9D69953: _worksheet_write_col_info (worksheet.c:2717)
==18860== by 0x9D69953: _worksheet_write_cols (worksheet.c:2785)
==18860== by 0x9D69953: lxw_worksheet_assemble_xml_file (worksheet.c:3340)
==18860== by 0x9D798F7: _write_worksheet_files (packager.c:178)
==18860== by 0x9D798F7: lxw_create_package (packager.c:894)
==18860== by 0x9D75056: workbook_close (workbook.c:1557)
==18860== by 0x57DDC11: hb_dynCall (hbdyn.c:956)
==18860== by 0x57D27E1: HB_FUN_HB_DYNCALL (hbdynhb.c:113)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DD8E8: hb_vmMacroFunc (hvm.c:5704)
==18860== by 0x58DD8E8: hb_vmExecute (hvm.c:2640)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DDF70: hb_vmExecute (hvm.c:1756)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DC2B9: hb_vmExecute (hvm.c:1769)
==18860==
==18860== HEAP SUMMARY:
==18860== in use at exit: 892,526 bytes in 6,471 blocks
==18860== total heap usage: 12,546 allocs, 6,075 frees, 44,445,681 bytes allocated
==18860==
==18860== LEAK SUMMARY:
==18860== definitely lost: 0 bytes in 0 blocks
==18860== indirectly lost: 0 bytes in 0 blocks
==18860== possibly lost: 186,696 bytes in 947 blocks
==18860== still reachable: 705,830 bytes in 5,524 blocks
==18860== of which reachable via heuristic:
==18860== length64 : 1,053 bytes in 117 blocks
==18860== newarray : 770,830 bytes in 5,908 blocks
==18860== suppressed: 0 bytes in 0 blocks
==18860== Rerun with --leak-check=full to see details of leaked memory
==18860==
==18860== For counts of detected and suppressed errors, rerun with: -v
==18860== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
[jan@ example]$

Can't build the lib

Harbour 3.2.0dev (r1709281311)
Copyright (c) 1999-2016, http://harbour-project.org/
Compiling 'hblibxlsxwriter.prg'...

100

hblibxlsxwriter.prg(17) Error F0029 Can't open #include file 'CStruct.ch'
hbmk2[libxlw]: Error: Running Harbour compiler (built-in). 255

After that i add xhb.hbc to libxlw.hbp and try again, but lib does't created:
...
Generating C source output to 'c:\tmp\hbmk_2ztkr5.dir\hblibxlsxwriter.c'... Done.
hblibxlsxwriter.prg(4898): Error! E1052: Expression has void type
hblibxlsxwriter.prg(4904): Error! E1052: Expression has void type
hbmk2[libxlw]: Error: Running C/C++ compiler. 1
wcc386.exe -6s -fp6 -onaehtr -s -ei -zp4 -zt0 -oi -zq -bt=nt -w3 -bc -ie:\dev\harbour\include -ie:\dev\harbour\contrib\xhb -ie:\dev\harbour\contrib\hbct -ie:\dev\harbour\contrib\hbtip -ie:\dev\harbour\contrib\hbfship -ie:\dev\harbour\contrib\hbxpp -ie:\dev\harbour\contrib\hbwin -i"e:\dev\libxlsxwriter-master\include" c:\tmp\hbmk_2ztkr5.dir\hblibxlsxwriter.c -fo=c:\tmp\hbmk_2ztkr5.dir\hblibxlsxwriter.obj

Missing file xlsxwriter.h to compile

I:\PROGRAMAS\hblibxlsxwriter>hbmk2 libxlw.hbp
hbmk2: Processando opções do ambiente: -comp=mingw
Harbour 3.2.0dev (r1405061532)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'hblibxlsxwriter.prg'...
Lines 5352, Functions/Procedures 178
Generating C source output to 'F:\Temp\hbmk_fn9tok.dir\hblibxlsxwriter.c'... Done.
hblibxlsxwriter.prg:4717:25: fatal error: xlsxwriter.h: No such file or directory
compilation terminated.
hbmk2[libxlw]: Erro: Executando compilador C/C++. 1
I:\HB32\comp\mingw\bin\gcc.exe -c -O3 -march=i586 -mtune=pentiumpro -fomit-frame-pointer -W -Wall -pipe -II:/HB32/include -II:/HB32/contrib/xhb -II:/HB32/contrib/hbct -II:/HB32/contrib/hbtip -II:/HB32/contrib/hbfship -II:/HB32/contrib/hbxpp -II:/HB32/contrib/hbwin -I"c:/source/libxlsxwriter-master/include" F:/Temp/hbmk_fn9tok.dir/hblibxlsxwriter.c

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.