Author Topic: Library Pdf  (Read 2113 times)

Luigi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Library Pdf
« on: April 13, 2020, 04:13:57 AM »
Hi,
Attached is a BCX program (testpdf.bas), which contains a library (libdocpdf.bas) that includes pdfgen and stb_image to create pdf files.
The zip contains a ready to run .exe, BCX and C source, I use the mingw64 compiler and old version of BCX (6.22).

Thanks for BCX it's a great tool for me and Sorry for my English.

Robert

  • Hero Member
  • *****
  • Posts: 1142
    • View Profile
Re: Library Pdf
« Reply #1 on: April 13, 2020, 01:44:08 PM »
Hi,
Attached is a BCX program (testpdf.bas), which contains a library (libdocpdf.bas) that includes pdfgen and stb_image to create pdf files.
The zip contains a ready to run .exe, BCX and C source, I use the mingw64 compiler and old version of BCX (6.22).

Thanks for BCX it's a great tool for me and Sorry for my English.

Hi Luigi:

Thank you for this code and app contribution.

The stb_image library is very interesting. I like the single file headers, similar to the Boost libraries, that can be dropped into any application without worrying about runtime library versions and such.

I retranslated with BCX 7.4.5 and compiled the C++ output with the latest Nuwen 17.1 compiler as 64 bit. No problems.

Well done!


iancasey

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Library Pdf
« Reply #2 on: May 23, 2020, 09:56:14 PM »
Luigi,
Thanks for the code,  I'm still trying to get my head around the c code portions. I am getting 100+ errors in PellesC.
PellesC seems to try to compile like it was 2 separate unrelated projects as variables in pdfgen.c are not available to the rest of the program. Has anybody got this to compile with PellesC and is there a trick I am missing?
 
Thanks again
+Ian
PS Your English is fine
« Last Edit: May 23, 2020, 10:26:33 PM by iancasey »

Robert

  • Hero Member
  • *****
  • Posts: 1142
    • View Profile
Re: Library Pdf
« Reply #3 on: May 23, 2020, 11:34:26 PM »
Luigi,
Thanks for the code,  I'm still trying to get my head around the c code portions. I am getting 100+ errors in PellesC.
PellesC seems to try to compile like it was 2 separate unrelated projects as variables in pdfgen.c are not available to the rest of the program. Has anybody got this to compile with PellesC and is there a trick I am missing?
 
Thanks again
+Ian
PS Your English is fine

Hi Ian:

64 bit Pelles C .... definitely not. For one thing it can not handle the inline assembly in stb_image.h.

Both Pelles 32 and 64 bit error out on this loop

Code: [Select]

    for (int i = 0; i < width * height * 3; i++) {
        char buf[3] = {"0123456789ABCDEF"[(data[i] >> 4) & 0xf],
                       "0123456789ABCDEF"[data[i] & 0xf], 0};
        dstr_append(&str, buf);
    }

Pelles C seems to have a problem parsing the set of the buf array. Plus the other errors which may vanish when the buf array parsing is fixed.

Nuwen compiler is my tool of choice for this job. The Nuwen MinGW64 distro is built by Stephan T. Lavavej, Principal Software Development Engineer at Microsoft, maintaining Visual Studio's C++ Standard Library implementation. Need I say more?

iancasey

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Library Pdf
« Reply #4 on: May 24, 2020, 12:06:32 PM »
Robert,
I had forgotten I was trying to compile as 64 bit,  :-[ but it is good to know that MinGW64 will compile this. I guess I will try MinGW.

Thanks
Ian

Robert

  • Hero Member
  • *****
  • Posts: 1142
    • View Profile
Re: Library Pdf
« Reply #5 on: May 24, 2020, 06:17:22 PM »
Robert,
I had forgotten I was trying to compile as 64 bit,  :-[ but it is good to know that MinGW64 will compile this. I guess I will try MinGW.

Thanks
Ian

Hi Ian:

MinGW is not as simple to set up as Pelles C.

I still use, out of habit and laziness, modified Andreas Guenther's bldbat with the NEEDED ftool and btool .exes to compile anything with MinGW.  James Fuller has a single batch files that he uses but it is complex as it does all-in-one whereas Andrea's setup had a separate batch file for each type of compile Gui, console, 64, 32 bit, XP etc. No sure about the XP.

Anyway if you need advice be sure to ask.

I know that MrBCX also uses MinGW but I'm not sure what his setup is.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
Re: Library Pdf
« Reply #6 on: May 24, 2020, 09:30:23 PM »
Quote from: Robert
I know that MrBCX also uses MinGW but I'm not sure what his setup is.

I have about a dozen batch files for several compilers, each batch file individually tailored for console, GUI, and DLL with versions of those for compiling 32bit apps and another set of batch files for creating 64 bit apps.  It's all customized for the way I set things up on all my computers.  I consistently install compilers on new computers using specific folder names and path locations, so that I can copy down my global \BAT\ folder, tweak the PATH environment variable for Windows and hit the ground running in no time flat.  My batch files cover Lcc, Pelles, Mingw, and MSVC.  Those are all I ever use.