Add exception handling code to example.

This commit is contained in:
Joachim Bauch
2019-02-24 14:54:07 +01:00
parent bf23ebf03c
commit 1adaf0ef66
4 changed files with 56 additions and 1 deletions
+3
View File
@@ -7,6 +7,9 @@ set (sources
add_definitions (-DSAMPLEDLL_EXPORTS)
add_library (SampleDLL MODULE ${sources})
if (NOT MSVC)
set_target_properties ("SampleDLL" PROPERTIES LINK_FLAGS "-static -lstdc++ -dynamic")
set_target_properties ("SampleDLL" PROPERTIES PREFIX "")
set_target_properties ("SampleDLL" PROPERTIES SUFFIX ".dll")
else ()
set (CMAKE_CXX_FLAGS "/EHs")
endif ()
+1 -1
View File
@@ -27,7 +27,7 @@ endif
OBJ = SampleDLL.o SampleDLL.res
SampleDLL.dll: $(OBJ)
$(LINK) $(LDFLAGS) -o SampleDLL.dll $(OBJ)
$(LINK) $(LDFLAGS) -static -lstdc++ -dynamic -o SampleDLL.dll $(OBJ)
%.o: %.cpp
$(CXX) $(CFLAGS) -c $<
+7
View File
@@ -7,4 +7,11 @@ SAMPLEDLL_API int addNumbers(int a, int b)
return a + b;
}
#ifdef _WIN64
SAMPLEDLL_API void throwException(void)
{
throw 42;
}
#endif
}