问一个在编dll assembly中使用new分配unmanaged memory地问题, 急
偶正在用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内存地分配
谢谢!!!