[Help] i need code dll with Form. lazarus / 31-LCL ---------------------------------------------------------------------- witawat · 2012-04-14 05:24 hello i need code starter about dll with form . thankyou ============================================== now i get code but not work. any one can help me? fix multitasking aiLog.7z than you in advanced ---------------------------------------------------------------------- KpjComp · 2012-04-16 20:22 You able to put your attachment somewhere we don't need to setup an account to download. eg. http://ge.tt/ ---------------------------------------------------------------------- witawat · 2012-04-18 03:09 new link http://ge.tt/8p5fkTG/v/0?c ---------------------------------------------------------------------- Martin_fr · 2012-04-18 10:36 See http://bugs.freepascal.org/view.php?id=1866 I haven't followed the topic, and don't know if there were changes to it. Last time I checked Forms could not be "used" in a DLL. (That is you can not have a Form defined and created in the DLL.) The main reason is, that such forms will get their own instance of TApplication and with that, their own msg loop (communication control to windows) This msg loop in the DLL will not be run. So Forms will not react to anything. Not sure, if and how it can be worked around. ---------------------------------------------------------------------- KpjComp · 2012-04-18 11:15 Quote from: Martin_fr on April 18, 2012, 12:36:21 pmNot sure, if and how it can be worked around. Yeah, I've kind of come up with the same result. In Delphi/Windows you had a couple of options.  That involved things like SharedMem and setting the application window handle inside the DLL.  But the easiest way of creating plugins was with Delphi Packages, unfortunately from what I can gather lazarus will only do statical linked packages.  Here was some info I made on creating a very easy plugin architecture for Delphi -> http://www.saxon.co.uk/SinglePkg/ One option I've though off is using interfaces that has Form/Control creating that the EXE can pass onto the DLL.  The main Disadvantage here is that Form design would have to be code only. ---------------------------------------------------------------------- Leledumbo · 2012-04-18 14:40 My solution for this is to have each dll maintain its own TApplication instance. Data interchange is done through a procedural API expecting opaque pointer (which is actually some kind of GUI element instance, e.g. a form). ---------------------------------------------------------------------- KpjComp · 2012-04-18 15:55 Quote from: Leledumbo on April 18, 2012, 04:40:33 pmMy solution for this is to have each dll maintain its own TApplication instance. Data interchange is done through a procedural API expecting opaque pointer (which is actually some kind of GUI element instance, e.g. a form). There is of course a few problems with this, but I suppose it depends on what your trying to achieve if its a problem or not. 1.  I don't believe MDI's are going to work. 2.  EXE & DLL size, are both going to have LCL overhead. 3.  Dialog's will need extra coding, aka. Your going to have 2 Tapplications running with there own messagepump. ---------------------------------------------------------------------- Leledumbo · 2012-04-19 01:17 Quote1.  I don't believe MDI's are going to work.Yes, of course. At least without advanced hack. QuoteEXE & DLL size, are both going to have LCL overhead.Indeed. QuoteDialog's will need extra coding, aka. Your going to have 2 Tapplications running with there own messagepump.Plus, I can't make my main form as parent of the dialog. Those are the dark sides, but the plugin works anyway. ---------------------------------------------------------------------- witawat · 2012-04-21 12:11 Then use http://wiki.freepascal.org/Multithreaded_Application_Tutorial can work ? ---------------------------------------------------------------------- KpjComp · 2012-04-21 17:07 He's not asking how to multi-thread, he's wanting to use Forms within DLL's.  It's most likely so he can create a plugin system or similar.