Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compile win32 library from exprtk

Tags:

c++

math

dll

exprtk

I would like to compile a win32 .dll or .lib from http://partow.net/programming/exprtk/index.html math expression library. What is the easiest way to do that ? I'm using MS VC++.

The code has only one .hpp that has all the code. Each time I compile my program it takes a long time because it compiles also exptrk.hpp file (over 1,000kB of code).

like image 236
knocker_d Avatar asked Jan 30 '15 14:01

knocker_d


1 Answers

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. 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/

The other solution is to write a small wrapper lib around exprtk and expose plain C functions from a DLL. Whether you can do this depends on how exactly you are using exprtk in your code.

like image 145
rep_movsd Avatar answered Sep 20 '22 10:09

rep_movsd