Author Topic: Codeblocks wx31_64 scripting error  (Read 4567 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Codeblocks wx31_64 scripting error
« on: December 03, 2019, 08:03:14 pm »
If i try to create a codeblocks plugin with my codeblocks wx31_64 on windows i get multiple asserts because of wrong format specifier...

this patch should fix it. Can someone test this on linux?

Code
Index: src/sdk/scripting/bindings/sc_wxtypes.cpp
===================================================================
--- src/sdk/scripting/bindings/sc_wxtypes.cpp (revision 11914)
+++ src/sdk/scripting/bindings/sc_wxtypes.cpp (working copy)
@@ -136,7 +136,7 @@
         if (sa.GetType(2) == OT_INTEGER)
         {
 #ifdef _SQ64
-            result.Printf(_T("%s%ld"), str1.c_str(), sa.GetInt(2));
+            result.Printf(_T("%s%I64d"), str1.c_str(), sa.GetInt(2));
 #else
             result.Printf(_T("%s%d"), str1.c_str(), sa.GetInt(2));
 #endif

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Codeblocks wx31_64 scripting error
« Reply #1 on: December 03, 2019, 08:13:05 pm »
If you want to print a 64bit int on more than one platform, the best way I've found is to cast it to long long and then use %lld.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Codeblocks wx31_64 scripting error
« Reply #2 on: January 03, 2020, 06:22:23 pm »
If you want to print a 64bit int on more than one platform, the best way I've found is to cast it to long long and then use %lld.
I second that. I think %I64d is not reliable enough.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ