[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: changes in 'require'
- From: "Joshua Jensen" <jjensen@...>
- Date: Fri, 8 Jul 2005 21:29:12 -0600
> >Instead of a patch, I would appreciate some clarification :)
> Should we
> >use NULL as the hModule argument?
>
> NULL gives the path of the executable (as MIke points out).
Yep. That's why the approach that LuaPlus uses works very well:
#ifdef _DEBUG
const char* luaplusdllName = "LuaPlusD_1084.dll";
#else // _DEBUG
const char* luaplusdllName = "LuaPlus_1084.dll";
#endif // _DEBUG
char modulePath[MAX_PATH];
GetModuleFileName(GetModuleHandle(luaplusdllName), modulePath,
_MAX_PATH);
char* slashPtr = strrchr( modulePath, '\\' );
slashPtr++;
*slashPtr = 0;
At work, we use a lot of feature branches. Each branch has a single copy of
LuaPlus in it. All scripts are run using the branch local version of
LuaPlus. By having the path to LuaPlus resolved this way, modules are
easily found branch local, too.
This approach works very well for us, and it might work well for Lua, too.
Josh