On 02/14/2015 05:04 PM, Stephen Leake wrote: > Eli Zaretskii writes: > >>> but I don't see how we are going to restrict what symbols are >>> available to the module. >> >> The way to restrict the export is to declare the symbols you want to >> export with __declspec(dllexport). Then only those symbols will be >> exported. >> >> Note that, since emacs.h will be included by modules as well, we will >> need something like >> >> #ifdef WINDOWS >> # ifdef emacs >> # define EMACS_EXPORT __declspec(dllexport) >> # else >> # define EMACS_EXPORT __declspec(dllimport) >> # endif >> # else >> # define EMACS_EXPORT >> #endif >> >> That's because they should be exported by Emacs, but imported by >> modules. > > Right, that makes sense. No it doesn't. Modules shouldn't be importing anything from Emacs: Emacs should _give_ modules a table of all function pointers they need. It's a lot less error-prone that way. > >>> Is there an acceptable (ie portable and reliable) way to determine the >>> OS in a Makefile? I'm not aware of one (short of Gnu config.guess). >> >> Windows can be detected by looking at environment variables. Since >> Make converts them to Make variables, they are easily accessed. >> >> Another possibility is to invoke "gcc -dumpmachine" via the $shell >> function. We could also invoke uname in a similar manner, but that >> requires MSYS or Coreutils to be installed. We could even invoke Make >> itself with the --version option, and see what follows the "Built for" >> header. >> >> So ways to do that exist, we just need to decide whether we want to go >> that way. > > I've attempted to take that approach for other projects, and it isn't > very portable >