Fixed C example
This commit is contained in:
		
							parent
							
								
									1edaf643c9
								
							
						
					
					
						commit
						50520bb1b8
					
				| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
// Only use this define once, cause it defines funcitons
 | 
			
		||||
#define PLUG_IMPL
 | 
			
		||||
#include "dim_sdk.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +39,9 @@ int plug_post_reload(void *state) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
int plug_on_msg(plug_msg_t* msg) {
 | 
			
		||||
    snprintf(p->ctx.buf, BUF_SZ, "Hello from C! (%d)", p->count++);
 | 
			
		||||
    if (strcmp(msg->name, "poll") == 0) {
 | 
			
		||||
        snprintf(p->ctx.buf, BUF_SZ, "Hello from C! (%d)", p->count++);
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user