There were minor errors in the load() and store() methods Body.
and if its implemented in serialize.cpp file the compiler was bypassing it and making the serialize.o
Code:
The Exception Classes had some constructor related error. (fixed)
srzFStream.read((char*)obj, sizeof(obj)); Here the casting was wrong
Changed to srzFStream.read(reinterpret_cast<char*>(&obj), sizeof(obj));
so at the time of linking it was not getting the whole methods. and thats why as I've already told nm and objdump was not showing the existance of load() and store() in the serialization class.
and thats why It was not even firing those errors in serialize.cpp while making serialize.o
If I put all in serialize.h or make it inline function it shows me up those Errors and when I fix it It Compiles.
I thought My evil days were at an end ehen It got compiled.
But nope.
after I execute it. it shut me off with this error.
Code:
*** glibc detected *** double free or corruption (fasttop): 0x0804f008 ***
/bin/sh: line 1: 1420 Aborted ./srz
Here is the New Project archived http://rapidshare.com/files/129808229/srz.tar.gz.html
the executable reacives SIGABRT Signal.
while debuging I notice some Wired thing.
Code:
1. How Can a Program reacieve SIGABRT on the last line of main() return EXIT_SUCCESS; (which evalutes to return 0)
2. why the programm is not abort() ing on uncaught Exceptions.
Its getting failedToWrite Exception on store() but still Continuing Processing ?? (I observed this while debuging)
I thing you've noticed there is not try catch Block in main() so it should call terminate() and then abort() on uncaught Exception
But what the glibc is Screwing here ??
even if I catch teh exceptions in main() the glic error is fired.
srz.cpp http://pastebin.com/f7c3e8a19
Code:
//main() function
int main(int argc, char *argv[]){
string x="Neel Basu";
string y;
try{
Serialization<string>::store(x, "/home/neel/Desktop/name.srl");
}catch(SerializationException ex){
cout<<ex.getErrMsg()<<endl;
}
try{
y=Serialization<string>::load("/home/neel/Desktop/name.srl");
}catch(SerializationException ex){
cout<<ex.getErrMsg()<<endl;
}
return EXIT_SUCCESS;
}
Its worth to mention that It has created the name.srl file with nothing in it (4B long)
Code:
0000:0000 | 14 D0 04 08 | .Ð..
which has no relation with the string Object that was meant to be serialized