I will create a small example and post when done - Thanks

Sergei Gorelkin wrote:

SteveG wrote:

error occurs with fpc 2.2.1, works ok with 2.0.4

I was thinking possible threading in relation to LCL access?
I have since found that the same code in the dll works ok if I call it from a syncronised function in the main app.

Your code example is thread-safe by itself if it is contained within a single function. This is because variables are located on the stack and no global data is accessed (except the memory manager). Maybe you have to tell the memory manager of DLL that your application is multithreaded (by setting IsMultiThreaded := True during DLL initialization).

If your application contains threading and LCL access, please try to provide a more complete example. Otherwise it is hard to guess what is going wrong.

Sergei


Sergei Gorelkin wrote:

SteveG wrote:

Could anyone tell me why the following code fails within a dll?

Worked ok with Laz 9.14, but no longer with Laz 9.23 (WindowsXP)
The same code works fine out of the dll - seems to want to sync with LCL thread I guess?



 > Access Violation at the 'doc.Appendchild(N);' line
 >
 > var doc :TXMLDocument;
 >     N   :TDOMNode;
 >
 >  doc := TXMLDocument.create;
 >  N   := TDOMNode.create(doc);
 >  N   := doc.CreateElement('root');
 >  doc.Appendchild(N);
 >  writeXMLFile(doc, 'C:\Test.xml');
 >  FreeAndNil(doc);
 >

It's hardly a threading issue, because XML package does not use threading in any way.

What version of compiler do you use, 2.0.4 or 2.2.0?

Sergei

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


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



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


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

Reply via email to