问一个在编dll assembly中使用new分配unmanaged memory地问题, 急

gadget111 2003-10-31 02:14:02
偶正在用mc++编一个assembly: filename.dll

使用集成编辑环境,建立一个class libary的sulotion
在其中一段代码如下:
char *p = new char[10];
Int32 myarray[] = new Int32[20];

build这个项目,发现link错误:
test error LNK2001: unresolved external symbol
"void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z)

去掉第一个new操作后,link正常.
后来,发现有一个/Zl地编译选项,去掉后, 提示不能使用
"/nonentry"选项,去掉"/nonentry"选项后,编译,连接成功,提示警告
信息:
warning LNK4243: DLL containing objects compiled with /clr is
not linked with /NOENTRY; image may not run correctly

但是在其他程序中运行该dll正常, 请问这是怎么一回事情?

为什么在建立class libary项目的默认条件下,不能使用new操作符
进行unmanaged内存地分配

谢谢!!!
...全文
25 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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