News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#11
General discussions / Re: Legacy header files
Last post by TimoVJL - May 03, 2026, 12:25:33 PM
Windows 11, 3.43.2.0
After updates, versio is 3.51.1
#12
General discussions / Re: Legacy header files
Last post by John Z - May 03, 2026, 12:08:49 PM
Thanks Robert!

This is very good to know. 
Personally I use the SQLite3 3.33.0 distribution. https://sqlite.org/
I see an update to 3.53 so I'm behind.

Get the C source code as an amalgamation, version 3.53.0. then just add 4 files to the program.
https://sqlite.org/download.html

John Z
#13
Bug reports / Undefined label issue
Last post by Vortex - May 03, 2026, 11:34:41 AM
Poasm Version 14.10.0 reports an error message while assembling the code below :

.386
.model flat,stdcall
option casemap:none

.code

    call    main
    ret

main PROC

    mov     eax,OFFSET sample
    ret

main ENDP

sample:

    db      'This is a test.',0

END

\PellesC\bin\poasm.exe /AIA32 sample.asm
sample.asm(12): error: Symbol 'sample' is undefined.
sample.asm(12): error: Symbol 'main.sample' is undefined.

This issue happens when a label is defined after a procedure.

#14
General discussions / Re: Legacy header files
Last post by Robert - May 02, 2026, 11:29:45 PM
Quote from: ander_cc on May 02, 2026, 06:03:06 AMThere are two header files in folder "Include/win/winsqlite/": winsqlite3.h and winsqlite3ext.h.
But no related .lib files are included in folder "Lib".
Is this a deprecated feature?

I suspect that Pelle did not include the .lib files for those .dlls because there was a security vulnerability.

https://learn.microsoft.com/en-us/answers/questions/5591853/vulnerability-in-winsqlite3-dll

#15
General discussions / Re: Legacy header files
Last post by John Z - May 02, 2026, 09:41:01 PM
Hi ander_cc,

A lot of help now 👍👍👍

You can also find the exported functions using:
 C:\Program Files\PellesC\Bin\pope.exe

Attached example shows part of the output for the winsqlite3.dll, copy paste not possible so image is attached.

John Z
#17
General discussions / Re: Legacy header files
Last post by TimoVJL - May 02, 2026, 09:16:02 PM
With simple example might be possible to check imports
#include <stdio.h>
#include <stdlib.h>
//#include "sqlite3.h"
#include <winsqlite/winsqlite3.h>

#pragma comment(lib, "WinSQLite3.lib")

int __cdecl main(int argc, char **argv)
{
    sqlite3 *db;
    int rc;
    char *szSQL =
        "DROP TABLE IF EXISTS test;"
        "CREATE TABLE IF NOT EXISTS test (id INTEGER NOT NULL PRIMARY KEY, text VARCHAR(100));"
        "INSERT INTO test VALUES (1, 'text1');"
        "SELECT * FROM test;";
    char *pSQL1, *pSQL2;

    printf("lib version: %u\n", sqlite3_libversion_number());
    rc = sqlite3_open("test.db3", &db);
    if (rc == SQLITE_OK)
    {
        sqlite3_stmt *stmt;
        pSQL1 = szSQL;    // at start
        do
        {
            rc = sqlite3_prepare_v2(db, pSQL1, -1, &stmt, (const char**)&pSQL2);
            if (rc == SQLITE_OK)
            {
                int nCols = sqlite3_column_count(stmt);
                if (nCols)
                {
                    int nCol;
                    for (nCol = 0; nCol < nCols; nCol++)
                        printf("%s\t", sqlite3_column_name(stmt, nCol));
                    printf("\n");
                    while ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
                        for (nCol = 0; nCol < nCols; nCol++)
                            printf("%s\t", sqlite3_column_text(stmt, nCol));
                    printf("\n");
                }
                sqlite3_finalize(stmt);
            } else {
                fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
                break;
            }
            pSQL1 = pSQL2;    // next statement
        } while (*pSQL2);
        sqlite3_close(db);
    } else {
        fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
        sqlite3_close(db);
        return 1;
    }
    return 0;
}
after that just use polib.exe to create import library.
If functions are cdecl., just use polib with dll.
An example import library have only few functions x86

WinSQLite3.def 32-bit
library winsqlite3.dll
exports
_sqlite3_libversion_number@0
_sqlite3_open@8
_sqlite3_prepare_v2@20
_sqlite3_column_count@4
_sqlite3_column_name@8
_sqlite3_column_text@8
_sqlite3_step@4
_sqlite3_finalize@4
_sqlite3_errmsg@4
_sqlite3_close@4
#18
General discussions / Re: Legacy header files
Last post by ander_cc - May 02, 2026, 05:12:14 PM
Quote from: John Z on May 02, 2026, 04:48:07 PMWell I'm far from an expert but I have used a dll in a program.
basically the use follows this:
1)LoadLibrary: Loads the DLL into memory.
2)repeat GetProcAddress: Get a pointers to the exported functions.
3)use the functions:
4)FreeLibrary: Unloads the DLL when done.

A quick web example where the dll contains 1 function:
__declspec(dllexport) int Add(int a, int b) {return a + b};

some code excerpts from one of my actual programs

Hopefully helpful, at least a start -

John Z
Many thanks for your detailed explanation. I will try.
#19
General discussions / Re: Legacy header files
Last post by John Z - May 02, 2026, 04:48:07 PM
Well I'm far from an expert but I have used a dll in a program.
basically the use follows this:
1)LoadLibrary: Loads the DLL into memory.
2)repeat GetProcAddress: Get a pointers to the exported functions.
3)use the functions:
4)FreeLibrary: Unloads the DLL when done.

A quick web example where the dll contains 1 function:
__declspec(dllexport) int Add(int a, int b) {return a + b};

// LoadDLL.c
#include <windows.h>
#include <stdio.h>

typedef int (*AddFunc)(int, int);

int main() {
    HMODULE hDll = LoadLibrary(TEXT("ExampleDLL.dll"));
    if (hDll == NULL) {
        printf("Failed to load DLL. Error: %d\n", GetLastError());
        return 1;
    }

    AddFunc add = (AddFunc)GetProcAddress(hDll, "Add");
    if (add == NULL) {
        printf("Failed to get function. Error: %d\n", GetLastError());
        FreeLibrary(hDll);
        return 1;
    }

    int result = add(2, 3);
    printf("2 + 3 = %d\n", result);

    FreeLibrary(hDll);
    return 0;
}

some code excerpts from one of my actual programs
// Load the dll

  swprintf(p_DllFile,260,L"%ls%ls",p_appdir, L"libxlsxio_write64.dll" );
  hXlsxLib = LoadLibrary(p_DllFile);
  if (hXlsxLib == NULL)
    { MessageBoxA(NULL,"Can't export because the DLL is missing.","XLSX Export",MB_OK|MB_ICONERROR);
      return;
}

// get the functions

/* set up DLL procs */
(FARPROC) add_cell_datetime  = GetProcAddress(hXlsxLib,"xlsxiowrite_add_cell_datetime") ;
(FARPROC) add_cell_float     = GetProcAddress(hXlsxLib,"xlsxiowrite_add_cell_float") ;
(FARPROC) add_cell_int       = GetProcAddress(hXlsxLib,"xlsxiowrite_add_cell_int") ;
(FARPROC) add_cell_string    = GetProcAddress(hXlsxLib,"xlsxiowrite_add_cell_string")  ;
(FARPROC) add_column         = GetProcAddress(hXlsxLib,"xlsxiowrite_add_column") ;
(FARPROC) write_close        = GetProcAddress(hXlsxLib,"xlsxiowrite_close") ;
(FARPROC) get_version        = GetProcAddress(hXlsxLib,"xlsxiowrite_get_version") ;
(FARPROC) get_version_string = GetProcAddress(hXlsxLib,"xlsxiowrite_get_version_string") ;
(FARPROC) next_row           = GetProcAddress(hXlsxLib,"xlsxiowrite_next_row") ;
(FARPROC) write_open         = GetProcAddress(hXlsxLib,"xlsxiowrite_open") ;
(FARPROC) set_detection_rows = GetProcAddress(hXlsxLib,"xlsxiowrite_set_detection_rows") ;
(FARPROC) set_row_height     = GetProcAddress(hXlsxLib,"xlsxiowrite_set_row_height") ;

 // use the exported function
 .....
 
// finally clean up
  // release DLL
  FreeLibrary(hXlsxLib) ;

Hopefully helpful, at least a start -

John Z
#20
General discussions / Re: Legacy header files
Last post by ander_cc - May 02, 2026, 03:48:47 PM
Quote from: John Z on May 02, 2026, 10:35:03 AMHi ander_cc,

There are two windows system dll's that might help -

C:\windows\system32\winsqlite3.dll
and
C:\windows\SysWOW64\winsqlite3.dll

John Z
I see, thank you very much! I find the dll. But how to use it?