Static linking?


Hello. I started using ChaiScript yesterday, and it looks very nice. Firstly I had a problem that after successfull compilation (msvc++ 2015) the exe crashed, but after copying 3 dlls from lib folder everything ran just fine. So here comes my question, is it possible to somehow make exe work without copying the dlls, especially if i would like to run exe on second computer, to not copy the dlls over and over, but to include them inside exe?

Edit: Actually something is wrong… for example the example script called from c++ crashes at runtime.

Thanks in advance for help :slight_smile:


You’re almost certainly making a debug build and using the packaged release build of ChaiScript, causing the crash.

A few things:

  • Since you’re using MSVC you should be able to distinguish between a segfault crash and an unhandled exception. Exceptions are easy to see what happened by looking at the exception .what() value.
  • You probably want to use the second ChaiScript example, the one with the built-in stdlib:
  • Strongly consider watching this video I just posted that walks through all of the possible issues you might hit while getting started with ChaiScript



I was using the precompiled stdlib. Downloaded source from git and built it myself. Everything works perfectly :slight_smile:


The include chaiscript_stdlib.hpp was the thing i was lookin for!

Anyways i got second question. When i write proper script (all types and methods okay) the script does the magic. But if i make a typo (getsomething instead of getSomething) im getting a crash (the "program stopped working’ windows message), not some exception, not even a stdout error print, but the whole process is dying. Is there any way to see what went wrong?


You are definitely getting an exception when you write a bad script. If you are making release builds MSVC might be hiding them from you. Watch the video I linked in the last message and it will show you how to deal with the message.

You can also look here for how to catch an eval exception:



Yea, thats it, try catch block catches the exception. Now, I do not have any more questions.
You Sir are GREAT!