I have an application which has been working fine under various PowerBuilder releases, 2017, 2019 & 2021. The application is compiled 64bit.
However, it will not run properly when compiled in PB 2022 R2 Build 2819.
The crash is when a function calls Windows API ReportEvent().
The crash is:
PowerBuilder application execution error (R0015)
Application terminated.
Error: Error calling external function %s at line 74 in function of_log2windows of object of_log2windows.
Function of_log2windows line 74 is:
if not ReportEvent(lul_eventsource, li_messagelevel, lul_category, aul_identifier, 0, UpperBound(ls_errmsg), 0, ls_errmsg, 0) then...
The ReportEvent prototype is:
FUNCTION boolean ReportEvent (ulong hEventLog, uint wType, uint wCategory, ulong dwEventID, ulong lpUserSid, uint wNumStrings, ulong dwDataSize, string lpStrings[], ulong lpRawData) Library "advapi32.dll" Alias For "ReportEventW"
Is there something wrong with my prototype? I notice it has an alias "ReportEventW". Should this be "ReportEventA:ansi"? What is the difference? Why is this only a problem with PB 2022 R2 but fine in earlier versions?
TIA
Larry
The location where the system DLL's reside, however, IS different. In Windows 32-bit, the 32-bit kernel32.dll resides in C:\Windows\System32. In Windows 64-bit, the 64-bit kernel32.dll resides in C:\Windows\System32 (!!!), so the path and name of the DLL is unchanged when changing bitness. The wrinkle is the 32-bit kernel32.dll in the 64-bit Windows O/S. It resides in C:\Windows\SysWOW64. "WOW64" is not a proclamation or exclamation, it stands for "Windows On WIndows-64". When a 32-bit application is executed in 64-bit Windows, The O/S redirects all system DLL references to the SysWOW64 subdirectory.
It sounds as though you are experienced in PB, but new to 64-bit. If so, I'd like to suggest you examine the Appeon publication "Migrating 32-bit Applications to 64-bit", if you have not already done so: https://docs.appeon.com/pb2022r2/migrating_32bit_applications_to_64bit/index.html
You may also benefit from examining a four-part tutorial regarding the interfacing of PB applications to the Windows API, available in the "Articles & Blogs" section of the Community:
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/302-interfacing-pb-applications-with-the-windows-api-part-1
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/303-interfacing-pb-applications-with-the-windows-api-part-2
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/304-interfacing-pb-applications-with-the-windows-api-part-3
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/305-interfacing-pb-applications-with-the-windows-api-part-4
Depending on which API functions and structures you are utilizing, there can be some additional complications when migrating to 64-bit, mostly involving structure member layout in memory and possible changes in structure size/length. The tutorials cover this topic and more.
The Community is here to help, so ask whenever you feel you need a little assistance. Good luck!