Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created April 8, 2016 12:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save roxlu/e618e63c789be258e25eb26b62532677 to your computer and use it in GitHub Desktop.
mkdir build
#include <stdio.h>
#include "SomeFunctions.h"
#include "Car.h"
void Car::print() {
printf("Car::print()\n");
test_function();
}
#ifndef CAR_H
#define CAR_H
class Car {
public:
void print();
};
#endif
cmake_minimum_required(VERSION 2.8)
project(PluginTest)
add_library(Transportation STATIC Car.cpp SomeFunctions.c)
add_library(Plugin MODULE Plugin.cpp)
target_link_libraries(Plugin Transportation)
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("Test with Plugin.\n");
return 0;
}
#include <stdio.h>
#include "Plugin.h"
#include "Car.h"
void plugin_init() {
printf("plugin_init().\n");
Car car;
car.print();
}
void plugin_update() {
printf("plugin_update().\n");
}
#ifndef PLUGIN_H
#define PLUGIN_H
#if defined(__cplusplus)
extern "C" {
#endif
void plugin_init();
void plugin_update();
#if defined(__cplusplus)
}
#endif
#endif
#include <stdio.h>
void test_function() {
printf("test function.\n");
}
#ifndef SOME_FUNCTIONS_H
#define SOME_FUNCTIONS_H
void test_function();
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment