Index: src/prelude/builtins.c
===================================================================
--- src/prelude/builtins.c	(revision 36982fc1f527597d650797d8db4fa9d288e819d9)
+++ src/prelude/builtins.c	(revision f9feab8cc2f80d40d81f4393bd616d37f41be6ef)
@@ -96,4 +96,25 @@
 static inline unsigned int ?\=?( unsigned int & x, unsigned long int y ) { x = x \ y; return x; }
 
+// type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions
+forall(dtype T)
+struct __Destructor {
+  T * object;
+  void (*dtor)(T *);
+};
+
+// defined destructor in the case that non-generated code wants to use __Destructor
+forall(dtype T)
+static inline void ^?{}(__Destructor(T) & x) {
+  x.dtor(x.object);
+}
+
+// easy interface into __Destructor's destructor for easy codegen purposes
+extern "C" {
+  forall(dtype T)
+  static inline void __destroy_Destructor(__Destructor(T) * dtor) {
+    ^(*dtor){};
+  }
+}
+
 // Local Variables: //
 // mode: c //
