----- Original Message -----
From: Wesley Smith
Date: 1/29/2008 8:35 PM
[
On Jan 29, 2008 7:29 PM, Fabio Mascarenhas <mascarenhas@acm.org> wrote:
Just put it in the same path as your .exe and you will be ok.
True. It's kind of lame though to have everything flat in the dir
like that. Ideally I'd have
MyApp.exe
support/
lua51.dll
... (other dlls)
Is this possible through some kind of build/linking option or should I
just get over it?
Unless support/ is in the PATH, launching MyApp.exe will fail.
You can cheat the system, though.
Add lua51.dll to the Delay Load DLLs list. As soon as your application
hits main()/WinMain(), call GetModuleFileName() to retrieve the full
filename of MyApp.exe (don't rely on argv[0]). Strip the MyApp.exe
from there to get the path to MyApp.exe and append support/lua51.dll to
it. Call LoadLibrary(pathExcludingMyAppExe + "support/lua51.dll").
Then everything will work as normal.
If delay loading a DLL isn't an option (I can't remember what OS it was
introduced in), then you'll have to either launch your app with a batch
file:
MyApp.bat:
@echo off
setlocal
set PATH=%~dp0support;%PATH%
start %~dp0MyApp.exe
or with a stub executable that sets the PATH and then launches the real
MyApp.exe.
Josh