When Using DLLs or Code-injecting to be Specific
this is an example class only intended for explainingclass test
{
int newint1;
char newchararray[512];
void (*newfunction1)( int newarg1 );
int newfunction2( bool newarg1, char newarg2 )
{
return newint1;
}
} mynewclass1;
that covers most common elements that's included in classes
now when exporting this function to another DLL or application and missed an element of those, either data member or function member, private or public what happens or changed their order ? and if each function is assigned it's value when Code-Injecting like mynewclass1.newfunction1 = (void *)(newexportedfunction);
what's the happens in this case, i开发者_开发技巧f members of the class are pointers that are assigned after class construction and then missed one member or changed their order ?
I suppose that you forget to add a public: (:)
mynewclass1 is a statically initialized to zero at load time (unless you are working on very old version of windows). if you add a constructor to your class behavior will become unpredictable because it is quite difficult to know when the static is effectively initialized (link-time dependencies at least).
精彩评论