简体   繁体   English

从exprtk编译win32库

[英]compile win32 library from exprtk

I would like to compile a win32 .dll or .lib from http://partow.net/programming/exprtk/index.html math expression library. 我想从http://partow.net/programming/exprtk/index.html数学表达式库中编译win32 .dll或.lib。 What is the easiest way to do that ? 最简单的方法是什么? I'm using MS VC++. 我正在使用MS VC ++。

The code has only one .hpp that has all the code. 代码只有一个包含所有代码的.hpp。 Each time I compile my program it takes a long time because it compiles also exptrk.hpp file (over 1,000kB of code). 每次我编译我的程序都需要很长时间,因为它还编译exptrk.hpp文件(超过1,000kB的代码)。

The problem of slow compilation you face is common when you have large header based libraries - but templates are not actually code, and cannot be compiled independently into a binary. 当你有大型的基于头的库时,你遇到的编译速度慢的问题很常见 - 但模板实际上不是代码,也不能独立编译成二进制文件。

One solution is to use precompiled headers - to my knowledge, VC++ does this automatically. 一种解决方案是使用预编译头 - 据我所知,VC ++会自动执行此操作。 This saves a lot of time, and works great for library headers that never change. 这节省了大量时间,适用于永不改变的库头。 See https://yxbenj.wordpress.com/2013/06/29/a-quick-guide-to-using-precompiled-headers-visual-studio/ 请参阅https://yxbenj.wordpress.com/2013/06/29/a-quick-guide-to-using-precompiled-headers-visual-studio/

The other solution is to write a small wrapper lib around exprtk and expose plain C functions from a DLL. 另一个解决方案是在exprtk周围编写一个小的包装器lib,并从DLL中公开普通的C函数。 Whether you can do this depends on how exactly you are using exprtk in your code. 是否可以执行此操作取决于您在代码中使用exprtk的具体程度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM