From: "Jialiang Ge [MSFT]" on
Hello David

> However it did change once when I link to the .OBJ instead of a larger
> .LIB then that class was working in both cases, but when going back to
> linking to LIB the difference showed up.

Could you please eleborate the larger lib and the obj file? Are they used
for? What part of your code snippet is in the lib or dll? It would be much
clearer if you could share a sample project.


Regards,
Jialiang Ge
Microsoft Online Community Support

=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

From: David F. on
I'll see if I can come up with a small sample that shows the problem when
I'm done with the latest project. If not, maybe a video.



""Jialiang Ge [MSFT]"" <jialge(a)online.microsoft.com> wrote in message
news:EHShfpOuKHA.4404(a)TK2MSFTNGHUB02.phx.gbl...
> Hello David
>
>> However it did change once when I link to the .OBJ instead of a larger
>> .LIB then that class was working in both cases, but when going back to
>> linking to LIB the difference showed up.
>
> Could you please eleborate the larger lib and the obj file? Are they used
> for? What part of your code snippet is in the lib or dll? It would be much
> clearer if you could share a sample project.
>
>
> Regards,
> Jialiang Ge
> Microsoft Online Community Support
>
> =================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>
>

From: David F. on

"Tim Roberts" <timr(a)probo.com> wrote in message
news:tr4mo5h41n5mqk9oaa0rla15rp8fqn0v30(a)4ax.com...
> "David F." <df2705(a)community.nospam> wrote:
>>
>>It would be like this:
>>
>>-- class header --
>>class MyClass
>>{
>> protected:
>> bool m_x64;
>> public:
>> MyClass(void);
>> virtual ~MyClass(void);
>>}
>>
>>-- class implementation --
>>
>>typedef void (WINAPI *LPFN_GetSystemInfo) (LPSYSTEM_INFO lpSystemInfo);
>>LPFN_GetSystemInfo fnGetSystemInfo=(LPFN_GetSystemInfo)
>>GetProcAddress(GetModuleHandle("kernel32"), "GetSystemInfo");
>>LPFN_GetSystemInfo fnGetNativeSystemInfo=(LPFN_GetSystemInfo)
>>GetProcAddress(GetModuleHandle("kernel32"), "GetNativeSystemInfo");
>
> Where is this code, exactly? Remember that your global variable
> initialization will happen when the binary that contains it is loaded,
> before any of the code in the binary. If you have that code in a "main"
> somewhere, then the variables will not be initialized when your global
> MyClass object is constructed.

Just like it was in the sample - winmain was there .. the --- was separating
things .. I though maybe it had to do with that but GetSystemInfo was fine
and moving the GetProcAddress within the constructor didn't work either.