00001
00002
00003 #include <fs/sys/fsLog.h>
00004
00005 #include <fs/sys/fsDll.h>
00006
00007 #include <cassert>
00008
00009 int main()
00010 {
00011 using namespace fs::sys;
00012
00013 FS_LOG("o.EXE The application has been launched.");
00014 FS_LOG("!.EXE Sample warning message!");
00015 FS_LOG("x.EXE Sample error message!");
00016 FS_LOG("o.EXE Still logs only into the log history...");
00017
00018 static Log_t AppLog(Log_t::LOG_FILE | Log_t::LOG_STDOUT);
00019 ModLog().SetTgt(&AppLog);
00020
00021 FS_LOG("o.EXE First routed (real-time) message.");
00022
00023 FS_LOG("o.EXE At this point a module is loaded.");
00024 {
00025
00026 fs::sys::Dll_t Dll("fsLogDll.dll");
00027 assert(Dll.IsValid());
00028
00029
00030 typedef void (* Bind_fn)(Log_t *, bool);
00031 Bind_fn pfnBind = static_cast<Bind_fn>(Dll.GetSymb("BindAppLog"));
00032 assert(pfnBind);
00033
00034
00035 (*pfnBind)(&AppLog, true);
00036
00037
00038 typedef int (* SomeDllFunc_fn)(int);
00039 SomeDllFunc_fn pfnSomeDllFunc = static_cast<SomeDllFunc_fn>
00040 (Dll.GetSymb("SomeDllFunc"));
00041 assert(pfnSomeDllFunc);
00042
00043
00044 int nRes = (*pfnSomeDllFunc)(10);
00045 FS_LOG("o.EXE The result of SomeDllFunc(10) is : %d", nRes);
00046
00047
00048 (*pfnBind)(&AppLog, false);
00049 }
00050 FS_LOG("o.EXE At this point the module is unloaded.");
00051
00052 FS_LOG("o.EXE The application is about to be terminated.");
00053
00054 return 0;
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070