Game Export Interface

3DS Max Plug-In SDK

VC7 memory wrapper for 3ds max

Overview

To accommodate for development of 3ds max 5.1 plug-ins using the VC7 development environment, Discreet has developed a system to address the incompatibility between the VC7 memory subsystem and 3ds max, which is VC6 native. Developers can employ this solution by including the MAX_Mem.h header in their plug-in project, which serves as a replacement for malloc.h, new.h and crtdbg.h. The result is to redirect memory allocation and de-allocation functions into equivalents implemented in the 3ds max core, operating on a VC6 native heap.

You can find this header in the maxsdk/include directory.

Limitations


The memory wrapper is necessary only in situations where memory allocated by a plug-in is later deallocated by 3ds max, or vice versa. In these cases, both operations must occur on the same VC6 heap. Any other memory used by a plug-in may reside on a VC7 heap, and in those cases the use of MAX_Mem is not necessary.

A limited set of memory allocation functions is supported under MAX_Mem. These include malloc(), free(), new, delete (including array forms) and heap inspector functions like _heapchk(). Functions which implicitly allocate memory, such as strcpy(), are not generally supported.

Expanding Memory Wrapper

Developers wishing to expand upon the memory wrapper may create their own VC6-compiled DLL which provides access to the necessary functions. The functions could be accessed using a preprocessor macro, which defines the original function name as a call to the VC6 exported function, or, in the case of new() and delete(), by using a function overload. These are only suggestions, and other schemes are possible at the developer’s discretion.

Further Information


For more information regarding VC7 compatibility with 3ds max, see the document “VC7 plugins for 3dsmax 5 and 5.1” in the Sparks Knowledgebase:

http://sparks.discreet.com/search/index.cfm?url=/knowledgebase/techdocs/searchable/Techdoc_3dsmaxVC7/3dsmax_VC7.htm