Recent

Author Topic: How to put a Form into a .dll file?  (Read 8274 times)

halflifezy

  • Jr. Member
  • **
  • Posts: 61
How to put a Form into a .dll file?
« on: June 13, 2011, 04:17:38 pm »
How to put a Form into a .dll file?
I new a form into a .dll project.
when compile it show that "Unit1.pas(8,22) Fatal: Can't find unit FileUtil used by Unit1"
how to solve?
thank you.
« Last Edit: June 17, 2011, 04:58:25 am by halflifezy »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How to put a Form into a .dll file?
« Reply #1 on: June 13, 2011, 05:55:11 pm »
Add LCL to your project dependencies. I didn't really remember the last state whether having forms in dll already works or not yet, please try yourself.

halflifezy

  • Jr. Member
  • **
  • Posts: 61
Re: How to put a Form into a .dll file?
« Reply #2 on: June 15, 2011, 10:50:11 am »
How to add LCL?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How to put a Form into a .dll file?
« Reply #3 on: June 15, 2011, 05:49:23 pm »
Project->Project Inspector->New Requirement->Choose LCL from the dropdown.

halflifezy

  • Jr. Member
  • **
  • Posts: 61
Re: How to put a Form into a .dll file?
« Reply #4 on: June 16, 2011, 12:05:01 pm »
still not solve.
it show error:   project1.lpr(12,1) Error: Undefined symbol: WSRegisterCustomImageList


errors like this more than 50.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12209
  • Debugger - SynEdit - and more
    • wiki
Re: How to put a Form into a .dll file?
« Reply #5 on: June 16, 2011, 12:13:20 pm »
Code: [Select]
uses Interfaces;
Interfaces must be in uses section.  (put it in your main pas file, the one that starts with "library" or "program")

Please also read http://bugs.freepascal.org/view.php?id=7182
« Last Edit: June 16, 2011, 12:16:27 pm by Martin_fr »

halflifezy

  • Jr. Member
  • **
  • Posts: 61
Re: How to put a Form into a .dll file?
« Reply #6 on: June 16, 2011, 12:14:22 pm »
errors is below

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How to put a Form into a .dll file?
« Reply #7 on: June 16, 2011, 06:40:03 pm »
Exactly like Martin said, you must have Interfaces in the uses section of the library.

halflifezy

  • Jr. Member
  • **
  • Posts: 61
Re: How to put a Form into a .dll file?
« Reply #8 on: June 17, 2011, 04:50:14 am »
thank you very much.
after add interfaces compile pass.
but run .exe file when call function
it paused immediately.
function as below:

 procedure showform();
 begin
 form2:=TForm1.Create(nil);
 form2.Show;
 end;
« Last Edit: June 17, 2011, 05:00:52 am by halflifezy »

 

TinyPortal © 2005-2018