gimer opened a new issue #85:
URL: https://github.com/apache/incubator-milagro-crypto-c/issues/85


   Hello,
   
   We've prepared bunch of changes that enable milagro compilation in MS Visual 
Studio.
   
   The changes can be divided into 3 groups:
    1. trivial name<->type clash
    2. variable array stack allocation (this is C99, which VS does not fully 
support, solutions below)
    3. static and dynamic symbol export (most intrusive part)
   
   Re 2. In case of C code adding `const` to array length vars doesn't change 
anything. There are 2 various solutions applied:
    * where possible, variable holding length is turned into define (i.e. `int 
n -> #define NUM_SHARES`)
    * where it's not possible 
[_alloca](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?view=vs-2019)
 is used (i.e. where length is passed via function arg)
   
   Re 3. Static libs should compile with modifications from 1 and 2, dynamic 
libs, require few more changes.
   Cmake's 
[CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS](https://cmake.org/cmake/help/v3.18/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html)
 is used to export most of the symbols, this however does not work for **data** 
exported via `amcl_curve_*` libraries
   To fix that:
    * definitions are prefixed with `SYMBOL_EXPORT` defined as emtpy for 
non-msvc in `amcl.h.in`
    * declarations are prefixed with `EXTERNAL_SYMBOL_DECLARATION`,
      * in case of non-vs, this is == `extern`
      * in vs case this is either `declspec(dllexport)` in case of 
`amcl_curve_*` libraries and `declspec(dllimport)` for all other libraries 
including those header files.
   
   Finally my question is following: would you prefer this change split into 
some smaller chunks, or is ok to issue it as a single pull request?
   
   FYI: whole change is here: 
https://github.com/apache/incubator-milagro-crypto-c/compare/develop...nemtech:msvc-compilation


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@milagro.apache.org
For additional commands, e-mail: issues-h...@milagro.apache.org

Reply via email to