Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: comsytec on April 02, 2014, 02:41:43 pm

Title: Scripting update proposal
Post by: comsytec on April 02, 2014, 02:41:43 pm
Hello

Can I propose this change in sqplus.h :

from:

Code
// === Class Type Helper class: returns a unique number for each class type ===

template<typename T>
struct ClassType {
  static SQUserPointer type(void) { return (SQUserPointer)&copy; }
  static CopyVarFunc getCopyFunc(void) { return (CopyVarFunc)&copy; }
  static void copy(T * dst,T * src) {
    *dst = *src;
  } // copy
};

to:

Code
// === Class Type Helper class: returns a unique number for each class type ===

template<typename T>
struct ClassType {
  static SQUserPointer type(void) __attribute__((noinline,noclone)) { return (SQUserPointer)&copy; }
  static CopyVarFunc getCopyFunc(void) __attribute__((noinline,noclone)) { return (CopyVarFunc)&copy; }
  static void copy(T * dst,T * src) __attribute__((noinline,noclone)) { *dst = *src; } // copy
};

Without it e.g. wxString instance assignment made through script calls introduced outside scripted wizard cause

Code
INSTANCE type assignment mismatch

error in running script for release version "-O2" compiled where the compiler optimized out mentioned methods from SDK DLL

The e.g. wxString must be referred then with

Code
extern template struct ClassType<wxString>;

in code (plugin) introducing new script features to prevent error mentioned above.
Title: Re: Scripting update proposal
Post by: oBFusCATed on April 02, 2014, 06:02:30 pm
Please provide a patch in a proper form: http://wiki.codeblocks.org/index.php?title=Creating_a_patch_to_submit_to_BerliOS_%28Patch_Tracker%29

Also it would be helpful if you provide the exact steps needed to reproduce the problem.