加载dll时,报错?求救

maxchen 2003-03-25 05:01:35
我用regsvr32注册一个dll时,报错如下:
××.dll was loaded,but the DllRegisterServer entry point was not found.
DllRegisterServer may not be exported,or a corrupt version of ××.dll may be in memory. Consider using PView to detect and remove it.

我重启了一次,仍是这样,怎么办??
...全文
116 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
maxchen 2003-03-26
  • 打赏
  • 举报
回复
我的客户端为什么总是动态库加载失败
HISTANCE hDLL=::LoadLibrary((LPCTSTR)"MyDll"); //加载DLL
if (hDLL!=NULL)
{
....
}
::MessageBox(0,"动态库加载失败!!!","Somthing Wrong",MB_OK);

.def文件编辑以后要放在哪个文件夹?与这有没有关系?
dawn33 2003-03-26
  • 打赏
  • 举报
回复
你有没有在注册表登记你的DLL呢?

YourDllName (REG_MULTI_SZ) <list of DLL Paths>
netxy 2003-03-26
  • 打赏
  • 举报
回复
hehe, if it's not a com inproc server, you don't have to use regsvr32 to register it. there are two ways to use a dll.
1, include the lib file in your project settings. Include the header file as well, and use the functions in the dll as windows APIs.
2,
typedef int (* MyFunc(int, int));
HINSTANCE hDllInst = LoadLibrary("MyDll.dll");
MyFunc myfunc = (MyFunc)GetProcAddress(hDllInst, "MyFunc");
myfunc(100,100);
...
FreeLibrary(hDllInst);
icansaymyabc 2003-03-26
  • 打赏
  • 举报
回复
既然你不是com组件,那还需注册吗?
既然你是中国人,你还需要美国身份证吗?
hwndhwnd 2003-03-26
  • 打赏
  • 举报
回复
pview就是visual studio工具里面带的process view,开始菜单里面有。感觉用法跟任务管理器差不多。不是COM组件就不用注册了。直接在程序里面写就可以了。
就像楼上所说的LoadLibrary(),GetProcAdress()得到dll里面函数的地址,然后用完了FreeLibrary()就可以了。
cboy2wzhx 2003-03-26
  • 打赏
  • 举报
回复
LoadLibrary("yourdll");....
maxchen 2003-03-26
  • 打赏
  • 举报
回复
楼上兄弟,我因为刚刚接触.dll,可能犯的错很幼稚,
我的.dll不是com组件,那我还需注册吗?
还想请教PView在哪里,如何用?
maxchen 2003-03-26
  • 打赏
  • 举报
回复
问题解决,谢谢!
hwndhwnd 2003-03-26
  • 打赏
  • 举报
回复
1。你的Dll是不是放在正确的目录。
2。用GetLastError看看错误描述。
maxchen 2003-03-26
  • 打赏
  • 举报
回复
哦,对不起,我忘了加一个else
hwndhwnd 2003-03-26
  • 打赏
  • 举报
回复
上面这段程序好像有逻辑错误吧。
::MessageBox(0,"动态库加载失败!!!","Somthing Wrong",MB_OK);
无论如何都会被执行的。
hwndhwnd 2003-03-25
  • 打赏
  • 举报
回复
regsvr32是注册com组件用的。不是任意dll都可以注册的。
COM组件里面要实现一个DllRegisterServer函数。regsvr32就是调用DllRegisterServer来注册的。
上面那段英文的意思是注册COM的时候找不到DllRegisterServer的入口点。DllRegisterServer没有被导出,或者内存里面有一份XX.dll。还要让你用PView去检测一下并且把它关了。

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧