Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

installing a package with components show message that dll can't be found

4 views
Skip to first unread message

Sakis Metallidis

unread,
Jun 5, 2008, 3:15:32 AM6/5/08
to
Hi Delphians,

I have written some components and put them in a package.
The components use some underlying DLL's.
I put the DLL's in the same directory where the package is saved.

When I compile the package I don't get any errors or warnings.

When I try to install the package I get a errormessage that the DLL can't be
found.


I can install the package if I put the DLL in the bin folder of my delphi
installation.
But I don't think that this is the right solution.

Anybody know how to solve this the right way?

Greetings,

Sakis


Pieter Zijlstra

unread,
Jun 5, 2008, 4:00:43 AM6/5/08
to
Sakis Metallidis wrote:

> I have written some components and put them in a package.
> The components use some underlying DLL's.
> I put the DLL's in the same directory where the package is saved.
>

> When I try to install the package I get a errormessage that the DLL
> can't be found.
>
> I can install the package if I put the DLL in the bin folder of my
> delphi installation. But I don't think that this is the right
> solution.
>
> Anybody know how to solve this the right way?

Below is link describing the search order Windows is using for
finding/loading DLLs.
http://msdn.microsoft.com/en-us/library/ms682586.aspx

--
Pieter

Remy Lebeau (TeamB)

unread,
Jun 5, 2008, 3:02:22 PM6/5/08
to

"Sakis Metallidis" <sakis.me...@gmail.com> wrote in message
news:4847928c$1...@newsgroups.borland.com...

> When I compile the package I don't get any errors or warnings.
>
> When I try to install the package I get a errormessage that the
> DLL can't be found.

The IDE likely moved the package binaries to another folder during
installation. You will have to manually move your DLL to that folder as
well, or else put it elsewhere on your machine that is in the OS search
path.


Gambit


Thomas Mueller

unread,
Jun 8, 2008, 2:07:07 PM6/8/08
to
Hi,

Sakis Metallidis wrote:

> I have written some components and put them in a package.
> The components use some underlying DLL's.
> I put the DLL's in the same directory where the package is saved.

That might be the problem: Windows searches the appliation's directory when
loading a dll, but that only applies to the application, not to a dll. A
package is just a glorified dll. Delphi can load it, because it knows its
full filename. But since your dll is in the package's directory and not in
Delphi's, it cannot be found.

The same problem applies to COM-Servers, by the way.

There are several solutions:
1. If you always put the DLL into the same directory as the package, just
prepend the dll name with the package's directory and load it using that
full filename.
2. Search for the dll yourself and start in the package's directory. Then
load it using the full filename.
3. Add the package's path to front of the environment variable path using
the SetEnvironment function. After that, Windows will find it for your.
This change to the environment only applies to the current application and
possibly applications it starts.

I think that 3. is the most flexible solution. There might be other options
but I can't think of any at the moment.

Of course there is the obvious solution of putting your dll somewhere into
the search path.

MfG
twm

Lee.Peng@China

unread,
Jul 8, 2008, 6:07:55 AM7/8/08
to
put the dll into system32
"Sakis Metallidis" <sakis.me...@gmail.com> 写入消息新闻:4847928c$1...@newsgroups.borland.com...
0 new messages