using c# i'm trying to load a dll written in C++/Cli, i used the following command:
Assembly assembly = Assembly.Load(assemblyName);
previously it has worked with no issues and i'm not exactly sure what changed but today i started getting the following error whenever i tried to load the dll
System.AccessViolationException: {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}
Both the dll and the code reading it are in the same solution and the dll itself is often changed (hence why i use dll).
does anyone have any idea what could cause this exception?
addendum:
I've narrowed it down to a lib I recently added which uses boost.
i used BOOST_LIB_DIAGNOSTIC
and found it uses the following:
Linking to lib file: libboost_date_time-vc100-mt-gd-1_54.lib
Linking to lib file: libboost_thread-vc100-mt-gd-1_54.lib
Linking to lib file: libboost_system-vc100-mt-gd-1_54.lib
Linking to lib file: libboost_chrono-vc100-mt-gd-1_54.lib
Found a boost post which seems to deal with a similar issue, but did not actually solve my problem.
it says to use the BOOST_ALL_DYN_LINK
preprocessor definition but all that does is cause further linkage errors:
fatal error LNK1104: cannot open file 'boost_date_time-vc100-mt-gd-1_54.lib'
The problem has been solved in the most obvious of ways.
downloaded and compiled boost from the top, got all the missing files (which for some reason were missing from my folder).
so in summary: added the
BOOST_ALL_DYN_LINK
preprocessor definition, recompiled boost to get all the missing files and made sure the dll's were in the appropriate folder.