Git Product home page Git Product logo

autodynamicheader's Introduction

Automatic Dynamic Header

Libraries like XDL exist, to load certain libraries at runtime instead of compiling against it. But, making one is tedious and painful.

Using this program is simple, and self explanitory: take a .h file of a regular library, and convert it into a new .h file that can load the .so/.dll/.dylib/whatever else at runtime after calling a function. The new header replaces the function declarations of the old one, so it must be included after the source one, like so:

// The orignal header contains original type and function declarations
#include <original/header.h>
// The new header redeclares all of the functions to be loaded dynamically
#include <dynamic/header.h>

Installing the program

This is made using .NET AOT, so it compiles down to a single binary. Add the binary to your PATH, and you're done! build from source using .NET. This only uses the standard library, so it should just work.

Usage

autodynamicheader [source] [destination] [name of load function]

The source and destination should be clear. The name of the load function is just what the function to load all the functions is called. Here is an example if "xload" is entered:

void xload(void *(*load_fn)(const char* name)) {
    ...
}

The function takes a function pointer to a function that will load the function given the function's name.

Important things to know

autodynamic header looks for things that look like functions, meaning macros and other structures are ignored. This means, pre-processing of the input file and post-processing of the output file is likely required. To be specific, the following items are not handled correctly and/or are ignored: - Macros - calling convention - keywords (extern, static, etc) - pre-procesing statements (#include, #ifdef, etc) - Pretty much anything C++ - probably a lot more

TODO

  • macros for adding things like calling conventions and other function declaration things eaiser
  • C++ filtering (the #ifdef + extern "C" crap)
  • fix edge cases with functions that return pointers

autodynamicheader's People

Contributors

bluesillybeard avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.