On Wed, 05 Sep 2007 11:05:51 +0200
"A.J. Venter" <[EMAIL PROTECTED]> wrote:

> Here's an odd one.
> In the OutKafelibs package, there is a TThread descendent (among a
> bunch of other classes). In previous versions of OutKafe I was calling
> TThread.Create repeatedly whenever I had to run a plugin - suffice to 
> say I found this hugely unclean (tthread.free doesn't have enough 
> guarantees) so I changed it to use and then continue to REUSE just
> one thread.
> This meant I had to go put TThread.Create somewhere each OutKafe
> program were bound to run it before the first event could be
> triggered. The logical place was inside the database creation code.
> Chaching -worked like a charm... until now that is.
> Suddenly whenever I install this package (set as a runtime+designtime 
> package) into the IDE the IDE crashes complaining of threading being 
> initialised BEFORE cthreads. But the dbconnect method SHOULD only be 
> called by apps using the unit - not by the IDE... why on earth would
> the IDE crash then ?

It means some units uses multithreading code. It does no matter if they
can not logically be called, because the compiler can not know this.
When you use threads, some RTL things must be initialized for that. One
of those things is using the cthreads unit under unix like systems.
You have two ways to fix this:
a) Don't compile the multithreaded units into any package that is
installed in the IDE. 
b) Add -dUseCThreads to the usage options of the package (custom
options). Then the IDE will use the cthreads unit automatically.

 
> I tried sticking cthreads in the unit and a bunch of other stuff, 
> nothing works. What DID let me go on, was to change the package to 
> runtime only, now the apps compile and run, and so does the IDE (with 
> the package not installed). But this is FAR from ideal - the package 
> SHOULD be installable. What could cause the IDE to try and create the 
> thread on startup ?


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to