+/****f* silcutil/SilcMemoryAPI/silc_memdup
+ *
+ * SYNOPSIS
+ *
+ * void *silc_memdup(const void *ptr, size_t size);
+ *
+ * DESCRIPTION
+ *
+ * Duplicates the memory area indicated by `ptr' which is of size
+ * of `size' bytes. Returns pointer to the duplicated memory area.
+ * This NULL terminates the dupped memory area by allocating `size' + 1
+ * bytes, so this function can be used to duplicate strings that does
+ * not have NULL termination.
+ *
+ ***/
+void *silc_memdup(const void *ptr, size_t size);
+
+/****f* silcutil/SilcMemoryAPI/silc_strdup
+ *
+ * SYNOPSIS
+ *
+ * char *silc_strdup(const char *str);
+ *
+ * DESCRIPTION
+ *
+ * Duplicates the string indicated by `str' and returns the duplicated
+ * string. Returns NULL on error and sets silc_errno.
+ *
+ ***/
+char *silc_strdup(const char *str);
+
+#else
+#ifndef SILC_DIST_TOOLKIT
+#error "The stack trace is not supported in this distribution"
+#endif /* SILC_DIST_TOOLKIT */
+
+#include "stacktrace.h"
+#endif /* SILC_STACKTRACE */
+
+
+/* Following functions that use SilcStack as memory source. */
+
+/****f* silcutil/SilcMemoryAPI/silc_smalloc
+ *
+ * SYNOPSIS
+ *
+ * void *silc_smalloc(SilcStack stack, SilcUInt32 size);
+ *
+ * DESCRIPTION
+ *
+ * Allocate memory block of size of `size' from the stack indicated by
+ * `stack' and return pointer to it. Returns NULL on error. This
+ * function allocates aligned memory so it can be used to allocate
+ * memory for structures, for example.
+ *
+ * NOTES
+ *
+ * Be careful with this function: do not free the returned pointer
+ * explicitly and do not save the returned pointer to a permanent
+ * location.
+ *
+ * If `stack' is NULL this function calls silc_malloc.
+ *
+ ***/
+void *silc_smalloc(SilcStack stack, SilcUInt32 size);