Skip to content

Instantly share code, notes, and snippets.

@dnaeon
Created July 7, 2015 07:35
Show Gist options
  • Save dnaeon/79faedd8c2c18b2e3d3d to your computer and use it in GitHub Desktop.
Save dnaeon/79faedd8c2c18b2e3d3d to your computer and use it in GitHub Desktop.
test-c-program-calling-rust
#include <stdio.h>
typedef struct
{
const char *key;
} PLUGIN;
PLUGIN *get_plugins(void);
int
main(void)
{
PLUGIN *plugins;
printf("Retrieving plugins ...\n");
plugins = get_plugins();
for (int i = 0; plugins[i].key != NULL; i++) {
printf("Discovered plugin: '%s'\n", plugins[i].key);
}
printf("All done.\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment