Board index » cppbuilder » Form inside a static lib again

Form inside a static lib again


2005-02-22 04:22:09 AM
cppbuilder94
Could anybody please help me in this problem?
I've created a static lib project in C++ Builder 6, and I put a form
inside it. I'd like to link this static lib in other projects, and use the
form inside lib. But when I link the lib with other projects, Builder shows
a link error: "Unable to open file 'MyFormInsideLib.dfm'". But if I copy
this file in same folder where my test project is, it links well. I want to
deliver only the .lib and .h files, not the .dfm file.
I've already put the "#pragma link *.dfm" statement in the .cpp file
that belongs to the form itself, but it didn't work.
I've posted both projects (EXE and LIB) in "borland.public.attachments"
(test.zip file)
I hope somebody could help me.
Thanks in advance.
Best regards,
Evandro Dugnani
 
 

Re:Form inside a static lib again

Could anybody please help me in this problem?
I've created a static lib project in C++ Builder 6, and I put a form
inside it. I'd like to link this static lib in other projects, and use the
form inside lib. But when I link the lib with other projects, Builder shows
a link error: "Unable to open file 'MyFormInsideLib.dfm'". But if I copy
this file in same folder where my test project is, it links well. I want to
deliver only the .lib and .h files, not the .dfm file.
I've already put the "#pragma link *.dfm" statement in the .cpp file
that belongs to the form itself, but it didn't work.
I've posted both projects (EXE and LIB) in "borland.public.attachments"
(test.zip file)
I hope somebody could help me.
Thanks in advance.
Best regards,
Evandro Dugnani
 

Re:Form inside a static lib again

Evandro Luis Ferreira Dugnani wrote:
Quote
I want to
deliver only the .lib and .h files, not the .dfm file.
I don't think you can do that but there's another issue here.
If you are giving someone a .lib they have to be linking with a
compatible linker and that pretty much means someone running the same
version of Builder.
Secondly as I understand it (and I could be wrong) the .dfm contains
(or represents) the resources for the form. If I'm right then they are
as important to the code inside the .lib as the .lib itself.
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

{smallsort}

Re:Form inside a static lib again

"Evandro Luis Ferreira Dugnani" < XXXX@XXXXX.COM >wrote in message
Quote
Could anybody please help me in this problem?

I've created a static lib project in C++ Builder 6, and I put a form
inside it. I'd like to link this static lib in other projects, and use the
form inside lib. But when I link the lib with other projects, Builder
shows
a link error: "Unable to open file 'MyFormInsideLib.dfm'". But if I copy
this file in same folder where my test project is, it links well. I want
to
deliver only the .lib and .h files, not the .dfm file.
I've already put the "#pragma link *.dfm" statement in the .cpp file
that belongs to the form itself, but it didn't work.
You cannot do this. A static library is a collection of object files, and
cannot include Windows resources, such as DFM's, icons, cursors, bitmaps,
etc. (Windows resources can only be included in a PE file).
And there is yet another problem: if you are using VCL components (like
forms), you must also distribute the VCL libraries. You will not be able to
just distribute a single .LIB and its associated .H files.
If you want to distribute a library that needs resources, you have to either
distribute the DFM files, or use a DLL or a package (BPL) instead.
- Dennis
 

Re:Form inside a static lib again

Thanks for your explanation Andrue.
Best regards.
Evandro Dugnani
"Andrue Cope [TeamB]" < XXXX@XXXXX.COM >escreveu na mensagem
Quote
Evandro Luis Ferreira Dugnani wrote:

>I want to
>deliver only the .lib and .h files, not the .dfm file.

I don't think you can do that but there's another issue here.

If you are giving someone a .lib they have to be linking with a
compatible linker and that pretty much means someone running the same
version of Builder.

Secondly as I understand it (and I could be wrong) the .dfm contains
(or represents) the resources for the form. If I'm right then they are
as important to the code inside the .lib as the .lib itself.

--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

Re:Form inside a static lib again

Thanks for your explanation Dennis.
Best regards.
Evandro Dugnani
"Dennis Jones" < XXXX@XXXXX.COM >escreveu na mensagem
Quote

"Evandro Luis Ferreira Dugnani" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>Could anybody please help me in this problem?
>
>I've created a static lib project in C++ Builder 6, and I put a form
>inside it. I'd like to link this static lib in other projects, and use
the
>form inside lib. But when I link the lib with other projects, Builder
shows
>a link error: "Unable to open file 'MyFormInsideLib.dfm'". But if I copy
>this file in same folder where my test project is, it links well. I want
to
>deliver only the .lib and .h files, not the .dfm file.
>I've already put the "#pragma link *.dfm" statement in the .cpp file
>that belongs to the form itself, but it didn't work.

You cannot do this. A static library is a collection of object files, and
cannot include Windows resources, such as DFM's, icons, cursors, bitmaps,
etc. (Windows resources can only be included in a PE file).

And there is yet another problem: if you are using VCL components (like
forms), you must also distribute the VCL libraries. You will not be able
to
just distribute a single .LIB and its associated .H files.

If you want to distribute a library that needs resources, you have to
either
distribute the DFM files, or use a DLL or a package (BPL) instead.

- Dennis