Skip to content

B0WEN-HU/Plugin-demo

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Plugin-demo

This is a demo of plugin structure

Execute the following command in the shell to run the program.

$sh build_and_run.sh

The program will give the hint.

Please input the code of the function y = foo(const int &x, int &y)

Input line will be the body of the function foo.cpp. For example, enter y = 7 * x + 11;. Then, the program will ask for the value of x.

Input the value of x:

Enter 3 for example. The program will give the answer.

y = 32

The demo accept standard input as the body part of foo.cpp, compile and link the foo.cpp into dynamic library named libfoo.so at runtime, then load the dynamic library to excute the foo.cpp by plugin.cpp. Declaration part of the foo.cpp is placed in _foo.template.

The structure is like:

main.cpp
├─── plugin.h
└─── plugin.cpp
     ├─── foo.h
     ├─── _foo.template
     └─── foo.cpp

About

A demo of plugin structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages