diff lwasm/symbol.c @ 206:080bb67d84f2

Add export pragma Added a pragma "export" which causes all exportable symbols to be exported automatically.
author William Astle <lost@l-w.ca>
date Thu, 24 May 2012 17:28:15 -0600
parents 17bd59f045af
children 07e1fac76321
line wrap: on
line diff
--- a/lwasm/symbol.c	Wed May 23 19:37:30 2012 -0600
+++ b/lwasm/symbol.c	Thu May 24 17:28:15 2012 -0600
@@ -205,6 +205,18 @@
 		else
 			sprev -> right = nse;
 	}
+	if (CURPRAGMA(cl, PRAGMA_EXPORT) && cl -> csect && !islocal)
+	{
+		exportlist_t *e;
+		
+		/* export symbol if not already exported */
+		e = lw_alloc(sizeof(exportlist_t));
+		e -> next = as -> exportlist;
+		e -> symbol = lw_strdup(sym);
+		e -> line = cl;
+		e -> se = nse;
+		as -> exportlist = e;
+	}
 	return nse;
 }