Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normal Debug build EAVs, GDB Debug build works - only affects x86 builds #654

Open
GWRon opened this issue Mar 22, 2024 · 1 comment
Open

Comments

@GWRon
Copy link
Contributor

GWRon commented Mar 22, 2024

Hotcakes at discord mentioned having an issue with some "old" function Grey Alien Games had in his "publicdomain.bmx":

I extracted that functionality and made a sample.bmx out of it (keeping the BlitzMaz intact :p):

SuperStrict
Framework Brl.StandardIO
Import Pub.Win32


'AERO SPECIFIC
'by col (Dave) from BlitzMaz forums
Global DwmapiDLL:Byte Ptr = LoadLibraryA("dwmapi.dll")
Global IsAeroEnabled(pfEnabled:Int Var)


If DwmapiDLL
    Print "loaded DLL"
    IsAeroEnabled = GetProcAddress(DwmapiDLL,"DwmIsCompositionEnabled")
EndIf

Global AeroState%
If DwmapiDLL IsAeroEnabled(AeroState)
'END OF AERO SPECIFIC

Print AeroState
Delay(2000)

Compile this on Windows as x86 debug build. Compile a "normal debug build" and it EAVs.
Compile a "gdb"-debug-build and it runs.

Maybe of help
The EAV comes up AFTER the "delay()" - so not right when accessing the function. Maybe something is cleaning up where it should not clean up - but why does it work though with the GDB info at hand (isnt this just a "code comment"?)

I am not sure if the code is even "correct" - the function normally returns a HRESULT - so I also tried different ways of including thw "dwmapi" but they failed already during linking state:

SuperStrict
Framework Brl.StandardIO
Import Pub.Win32
'Import "-dwmapi" 'seems not to "find something"
'Import "-ldwmapi" 'neither does this

'direct C code ...
'!#include <dwmapi.h>

Extern "win32"
    Function IsAeroEnabled:Int(pfEnabled:Int Var)="HRESULT DwmIsCompositionEnabled(WINBOOL *)!"
End Extern

Global AeroState%
Print IsAeroEnabled(AeroState)
'END OF AERO SPECIFIC

Print AeroState

While the normal "imports" fail with undefined references, the "raw c code"-one fails with some unallowed stuff in class error indicating that I did incorrect again.

C:/Tools/BlitzMax/MinGW32x86/i686-w64-mingw32/include/uxtheme.h: In function '_bb_main':
C:/Tools/BlitzMax/MinGW32x86/i686-w64-mingw32/include/uxtheme.h:212:25: error: invalid storage class for function 'SetWindowThemeNonClientAttributes'
  212 | static __inline HRESULT SetWindowThemeNonClientAttributes(HWND hwnd,DWORD dwMask,DWORD dwAttributes)
      |  

But this is just "side information" (there is the EAV - and there is the functionality I guess Hotcakes or someone else wanted to have).

@GWRon
Copy link
Contributor Author

GWRon commented Mar 23, 2024

According to @davecamp this solves the "functionality" part - but I still am unsure why the gdb-information generation had an effect regarding the EAV (...not EAVing).

Global IsAeroEnabled:Int(pfEnabled:Int Var)"Win32"

(only 32bit builds care for the "win32"-extension)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant