Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-03

Re: SQLite Header File

7 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Taj Morton: Hi! I'm looking for a new header file for SQLite...the old one included with FPC 1.0.3…
Taj Morton wrote 8 lines
Hi! I'm looking for a new header file for SQLite...the old one included with FPC 1.0.3 doesn't seem to work (program dies with: Creating class Inconsistency detected by ld.so: dl-minimal.c: 134: realloc: Assertion `ptr == alloc_last_block' failed!) Any idea where I can get a new one?

The one distributed with FPC is correct. The error you get is because you probably forgot to put 'cmem' as the first unit in your program's uses clause.

Michael.

Reply by email

Taj Morton

Hi!
I'm looking for a new header file for SQLite...the old one included with FPC 1.0.3 doesn't seem to work (program dies with:
Creating class
Inconsistency detected by ld.so: dl-minimal.c: 134: realloc: Assertion `ptr == alloc_last_block' failed!)

Any idea where I can get a new one?
Thanks!
--Taj

"I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up." -- Mark Twain, "The Innocents Abroad"

Reply by email

Jeff Pohlmeyer
Show quoted text 5 lines
> Inconsistency detected by ld.so: dl-minimal.c: 134: > realloc: Assertion `ptr == alloc_last_block' failed!) The error you get is because you probably forgot to put 'cmem' as the first unit in your program's uses clause.

I'm not sure about SQLite, but i have seen this problem using some other libs. Sometimes just putting:

  {$LINKLIB "c" }

- in the program file stops the error.

I assume this lets the lib use the C routines, and the FreePascal side can still use its own.

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster http://search.yahoo.com

Reply by email

Peter Vreman
to Jeff Pohlmeyer
Show quoted text 16 lines
> > Inconsistency detected by ld.so: dl-minimal.c: 134: > > realloc: Assertion `ptr == alloc_last_block' failed!) > The error you get is because you probably forgot to put 'cmem' > as the first unit in your program's uses clause. I'm not sure about SQLite, but i have seen this problem using some other libs. Sometimes just putting: {$LINKLIB "c" } - in the program file stops the error. I assume this lets the lib use the C routines, and the FreePascal side can still use its own.

All bindings that bind to a C library need to include {$linklib c}. When it is not there it is a bug in the binding. The {$linklib c} is required to let fpc know that it needs to use special startup code.

Reply by email

Marco van de Voort
to Peter Vreman
Show quoted text 8 lines
> - in the program file stops the error. > > I assume this lets the lib use the C routines, and > the FreePascal side can still use its own. All bindings that bind to a C library need to include {$linklib c}. When it is not there it is a bug in the binding. The {$linklib c} is required to let fpc know that it needs to use special startup code.

It is better to include unit initc though, then including {$linklib c}

Reply by email

Taj Morton
to Marco van de Voort

Hi Marco,

Show quoted text 6 lines
> > All bindings that bind to a C library need to include {$linklib c}. When > it is not there it is a bug in the binding. The {$linklib c} is required > to let fpc know that it needs to use special startup code. It is better to include unit initc though, then including {$linklib c}

Thanks! Got it working!

Find a patch below the example
in /usr/src/fpc-1.0.10/packages/base/sqlite/test.pas

--- test.pas    2004-03-03 15:41:32.000000000 -0800
+++ test-new.pas        2004-03-03 15:42:32.000000000 -0800
@@ -1,6 +1,7 @@
 program test;
-uses sqlite,sqlitedb, strings,classes;
+uses sqlite,sqlitedb, strings,classes,initc;

+{$linklib c}

 var
   MySQL: TSQLite;

Thanks again!
--Taj

"Gee, Toto, I don't think we are in Kansas anymore."

Reply by email

kractor
to Taj Morton
Taj Morton wrote 18 lines
>It is better to include unit initc though, then including {$linklib c} Thanks! Got it working! Find a patch below the example in /usr/src/fpc-1.0.10/packages/base/sqlite/test.pas --- test.pas 2004-03-03 15:41:32.000000000 -0800 +++ test-new.pas 2004-03-03 15:42:32.000000000 -0800 @@ -1,6 +1,7 @@ program test; -uses sqlite,sqlitedb, strings,classes; +uses sqlite,sqlitedb, strings,classes,initc; +{$linklib c} var MySQL: TSQLite;

now, if i'm reading this right (and its pretty good chance that i'm not ... heh) all i need to do is follow the same guidelines as the uses statement above along with the var declaration for MySQL?

then i'm hoping the syntax used w/ the mysql unit will be the same or very similar?

Reply by email