First off, this question doesn't have to do with actually creating a new
component, but since it has to do with packages and VCL components, I
thought the experts in writing components would best be able to answer my
question.
Basically, we're trying to break up a large project into several different
modules. We figured that putting different forms into different DLLs or
packages would be the best thing to do. The main help file says that using
packages is simpler than using DLLs, and provides better support for VCL, so
that's the option that we're testing out now.
My task is to create a package containing one form, and then to use that
package in another project, creating the packaged form and manipulating it
from a separate form or source file (since this is what our software product
needs to do). I set up the package as runtime only, and I've added the
form's unit to the package. Everything compiles fine, and I made sure to put
the PACKAGE macro in front of the form's class declaration and the separate
helper functions that I want to export.
I also succesfully (I think) linked the package to a new project. The
package is statically linked inside the project options under runtime
packages. Everything seems to work correctly, until I try to create a new
instance of the form inside my application. Using the de{*word*81}, I've
determined that there is some type of access error and it occurs somewhere
in the constructor for TCustomForm. The actual errors occurs somewhere in
nt.dll so I figure it's in one of the WinAPI calls. Since there is no source
for TCustomForm however, I can't find exactly what's going on. I thought
that maybe it has to do with the Owner parameter, but I've tried all sorts
of things, and nothing works. I've also tried using a helper function within
the package that does the actual new TForm call, but that causes the same
error.
I then tried putting the packaged form in a separate new project, just to
make sure the code was all right. In the new application (outside of the
package) it is created as normal without any problems, just like any other
form in a standard application.
So my question is, what am I doing wrong? :)
Are you not allowed to export forms through runtime packages? Am I better
off using DLLs? Hopefully this made some sense, and someone out there has an
answer for me.
Thanks in advance...
Jeremy