-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/example: add testing constructors and destructors
- Loading branch information
Showing
7 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <stdio.h> | ||
|
||
__attribute__((constructor)) static void constructor(void) { | ||
printf("constructor\n"); | ||
} | ||
|
||
int main(void) {} | ||
|
||
__attribute__((destructor)) static void destructor(void) { | ||
printf("destructor\n"); | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
#include <stdio.h> | ||
#define EXPORT_AS(name) __attribute__((export_name(name))) | ||
|
||
__attribute__((constructor)) static void constructor(void) { | ||
printf("constructor\n"); | ||
} | ||
|
||
EXPORT_AS("hello") void hello(void) { printf("hello world\n"); } | ||
|
||
EXPORT_AS("__wasm_call_dtors") void __wasm_call_dtors(void) { | ||
printf("real destructor\n"); | ||
} |
Binary file not shown.
Binary file not shown.