Git Product home page Git Product logo

Comments (3)

btzy avatar btzy commented on August 15, 2024

Macros seem to be, on hindsight, a bad idea.

On Mac and Linux, change the utf8 macros to function definitions, so that all 3 platforms have both sets of function exports.

I think this is the better thing to do - get rid of the macros, and have all 3 platforms export both sets of functions. It should probably be possible in the Mac and Linux implementations to have some __attribute__((alias("stuff"))) stuff to map both exports to the same function definition, so we don't need extra function wrappers (and the header file shouldn't need to know about this aliasing stuff). Will this work with the binding generators? If they only consume the header file, then I think it should work. This should be fully ABI compatible, and essentially API compatible unless someone uses complicated macro or template magic over the macros in the library.

On Mac and Linux, change utf8 to be the default and native to be the macro.

We can't do this without breaking ABI. NFDe is a package at least on Fedora, which uses it as a dynamic library, so changing the names of exported functions will result in a loader error on the end user's machine. Also, those who build NFDe statically will get link errors. In any case, I don't think continuing to use macros are a good idea, just to save a few bytes in the compiled library.

from nativefiledialog-extended.

ds5678 avatar ds5678 commented on August 15, 2024

I'm running into issues on Mac because of signature differences:

NFD_API void NFD_FreePathN(nfdnchar_t* filePath);
NFD_API void NFD_PathSet_FreePathN(const nfdnchar_t* filePath);

//I used real function definitions on Mac and Windows because alias seems unsupported.
void NFD_PathSet_FreePathN(const nfdnchar_t* filePath) {
    NFD_FreePathN(const_cast<nfdnchar_t*>(filePath)); //const_cast doesn't seem to be supported on Mac.
}

https://github.com/AssetRipper/nativefiledialog-extended/actions/runs/7171753252
https://github.com/AssetRipper/nativefiledialog-extended/tree/replace-macros-with-alias

from nativefiledialog-extended.

ds5678 avatar ds5678 commented on August 15, 2024

I figured it out. :)

from nativefiledialog-extended.

Related Issues (20)

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.