new (nothrow)
От: Кодт Россия  
Дата: 09.06.05 09:28
Оценка:
VC6sp6, debug multithreaded dll crt.

В довольно большой DLL написал new(nothrow)int[123] — и получил маты от линкера.
XXXXX.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,struct std::nothrow_t const &)" (??2@YAPAXIABUnothrow_t@std@@@Z)
XXXXX.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct std::nothrow_t const  std::nothrow" (__imp_?nothrow@std@@3Unothrow_t@1@B)

Написал тест — всё скомпилировалось (cl /GR /GX /LD /MDd test.cpp).
#include <windows.h>
#include <atlbase.h>

#include <new>
using namespace std;

__declspec(dllexport) void mains()
{
  int* x = new(nothrow) int[123];
}

BOOL APIENTRY DllMain(HANDLE,DWORD,LPVOID) { return true; }

Что бы это могло быть?
Перекуём баги на фичи!
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.