EASTL icon indicating copy to clipboard operation
EASTL copied to clipboard

Windows DLL

Open XNerv opened this issue 4 years ago • 2 comments

I have a doubt. I know that for compilation in a static library it is necessary. But, is it necessary to provide the new[] operator when compiling the eastl library as a DLL? If not, why not?

void* operator new[](size_t size, const char* pName, int flags, unsigned debugFlags, const char* file, int line);
void* operator new[](size_t size, size_t alignment, size_t alignmentOffset, const char* pName, int flags, unsigned debugFlags, const char* file, int line);

XNerv avatar May 06 '21 01:05 XNerv

Is this a documented requirement for static linking? I've just run into this.

ScatteredRay avatar May 06 '21 02:05 ScatteredRay

Is this a documented requirement for static linking? I've just run into this.

Yes, you can see more info here https://github.com/electronicarts/EASTL/blob/master/doc/FAQ.md#info15-how-hard-is-it-to-incorporate-eastl-into-my-project

In the following file you can find this... https://github.com/electronicarts/EASTL/blob/fad54717f8e4ebb13b20095da7efd07a53af0f10/include/EASTL/allocator.h#L169

#if !EASTL_DLL // If building a regular library and not building EASTL as a DLL...
		// It is expected that the application define the following
		// versions of operator new for the application. Either that or the
		// user needs to override the implementation of the allocator class.
		void* operator new[](size_t size, const char* pName, int flags, unsigned debugFlags, const char* file, int line);
		void* operator new[](size_t size, size_t alignment, size_t alignmentOffset, const char* pName, int flags, unsigned debugFlags, const char* file, int line);
#endif

This is the reason for my original doubt. According to the source code, the new[] operator is only required in the "eastl" static compilation. However, nothing is said in the documentation if this is necessary for static or dynamic build.

XNerv avatar May 07 '21 00:05 XNerv