Click to See Complete Forum and Search --> : Re: Specifying a search path for a dll ?


ralph
08-27-2002, 05:59 AM
"geof" <g1c3b@aol.com> wrote:
>
>
>
>I'm creating a C dll, using Microsoft Visual Studios 6.0.
>It needs to call a function in another dll that is located in a different
>folder. I can not move the other dll into the search path. Is their a way
>to specify another search path for the first dll?
>
>any help is appreciated.
>

When you register an ActiveX (COM) DLL it provides the path information.
An ActiveX DLL, therefore, does not need to be in the "search" path. If it
is not an ActiveX component then you can provide additional path information
by adding the DLL's location in the environmental %PATH% setting.

Otherwise you will need to explicitly link with the DLL using LoadLibraryX().

geof
08-27-2002, 07:47 AM
Ralph,
Thanks for your response.

My dll is not an ActiveX dll. I think some people would call it a "regular
dll" written in C.

You wrote:

<< you can provide additional path information by adding the DLL's location
in the environmental %PATH% setting. >>

How do I specify the environmental PATH setting in Visual Studios 6.0 ?
I'm not that familiar with the C++ Visual Studio Development environment.

Thanks,
Geof










"ralph" <nt_consulting32@hotmail.com> wrote:
>
>"geof" <g1c3b@aol.com> wrote:
>>
>>
>>
>>I'm creating a C dll, using Microsoft Visual Studios 6.0.
>>It needs to call a function in another dll that is located in a different
>>folder. I can not move the other dll into the search path. Is their a way
>>to specify another search path for the first dll?
>>
>>any help is appreciated.
>>
>
>When you register an ActiveX (COM) DLL it provides the path information.
>An ActiveX DLL, therefore, does not need to be in the "search" path. If
it
>is not an ActiveX component then you can provide additional path information
>by adding the DLL's location in the environmental %PATH% setting.
>
>Otherwise you will need to explicitly link with the DLL using LoadLibraryX().

Jane Zeikel
08-28-2002, 12:22 AM
You can specify it in several ways through the system. Go to Start,Control
Panel, System, er... S***T I only have XP here and it doesn't have the
options in the same place as NT4 or Win2K!!! You need to look for a button
or tab here that specifies environment variables - you can add the path here
for the system or just for you as user.

also you could use a command prompt and do the following

set path=%path%;newpath
in the above newpath is the path to your dll - the %path%; retains the old
path and appends newpath to the environment variable
then from this same command prompt CD to the MS VC++ directory and start
msdev.exe (this env var setting will be discarded when you kill the command
prompt)

you could also specify
set path=%path%;newpath in autoexec.bat

or also in some batch file you write which then starts msdev after setting
the env variable.

I think you can also set search paths in the project settings for your VC++
project - try the linker tab and select input - I can't remember, I also
don't have a copy of VC++ on this machine <sigh> sorry!

finally if you can't find somewhere to set the search path - copy the dll in
question to the source (or maybe debug) directory for your project, I
believe it is in the default search path for dlls for a project - although
this can be problematic because the dlls can easily become out of synch or
you may forget you have it in the source dir at all, making it really
difficult for someone else to build the project... etc...etc...

Jane

>
> How do I specify the environmental PATH setting in Visual Studios 6.0 ?
> I'm not that familiar with the C++ Visual Studio Development environment.
>
> Thanks,
> Geof
>
>

Jim
08-28-2002, 09:10 PM
You can also set the path programatically with the Win32 API
BOOL SetEnvironmentVariable(
LPCTSTR lpName, // environment variable name
LPCTSTR lpValue // new value for variable
);

Note that this function is process specific and does not affect the actual
system environment variable values.

"Jane Zeikel" <janNOSPAM@yahoo.co.uk> wrote:
>You can specify it in several ways through the system. Go to Start,Control
>Panel, System, er... S***T I only have XP here and it doesn't have the
>options in the same place as NT4 or Win2K!!! You need to look for a button
>or tab here that specifies environment variables - you can add the path
here
>for the system or just for you as user.
>
>also you could use a command prompt and do the following
>
>set path=%path%;newpath
>in the above newpath is the path to your dll - the %path%; retains the old
>path and appends newpath to the environment variable
>then from this same command prompt CD to the MS VC++ directory and start
>msdev.exe (this env var setting will be discarded when you kill the command
>prompt)
>
>you could also specify
>set path=%path%;newpath in autoexec.bat
>
>or also in some batch file you write which then starts msdev after setting
>the env variable.
>
>I think you can also set search paths in the project settings for your VC++
>project - try the linker tab and select input - I can't remember, I also
>don't have a copy of VC++ on this machine <sigh> sorry!
>
>finally if you can't find somewhere to set the search path - copy the dll
in
>question to the source (or maybe debug) directory for your project, I
>believe it is in the default search path for dlls for a project - although
>this can be problematic because the dlls can easily become out of synch
or
>you may forget you have it in the source dir at all, making it really
>difficult for someone else to build the project... etc...etc...
>
>Jane
>
>>
>> How do I specify the environmental PATH setting in Visual Studios 6.0
?
>> I'm not that familiar with the C++ Visual Studio Development environment.
>>
>> Thanks,
>> Geof
>>
>>
>
>