
########################
A3DDllSetCallbacksMemory
########################

.. c:function:: A3DStatus A3DDllSetCallbacksMemory(A3DCallbackMemoryAlloc, A3DCallbackMemoryFree)

   .. rst-class:: sig-pretty-signature
   
      | :c:enum:`~A3DStatus` A3DDllSetCallbacksMemory(:c:type:`~A3DCallbackMemoryAlloc`\ , :c:type:`~A3DCallbackMemoryFree`\ )
   
   Specifies custom memory-allocation functions This function specifies callback functions the library uses for memory allocation and and deallocation.
   
   If this function is not called, the standard ``malloc`` and ``free`` functions are used for memory allocation and deallocation.
   
   
      2.0
   
   
   .. rubric:: Sample code
   
   
   .. code-block:: cpp
   
      A3DPtr my_alloc(A3DUns32 uiSize) { return malloc(uiSize); }
      A3Dvoid my_free(A3DPtr ptr) { if (ptr) free(ptr); }
      
      A3DInt32 iErr = A3D_SUCCESS;
      A3DInt32 iMajorVersion,iMinorVersion = 0;
      
      iErr = A3DDllGetVersion( &iMajorVersion, &iMinorVersion );
      iErr = A3DDllInitialize( A3D_DLL_MAJORVERSION, A3D_DLL_MAJORVERSION );
      if ( iErr == A3D_SUCCESS )
      {
          iErr = A3DDllSetCallbacksMemory( my_alloc , my_free );
          iErr = A3DDllTerminate();
      }
   
   **Returns**
   
   
      ``A3D_SUCCESS`` on success, or an error code on failure
   
   




