<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Beldaz</id>
	<title>Code::Blocks - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Beldaz"/>
	<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php/Special:Contributions/Beldaz"/>
	<updated>2026-04-21T02:18:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7062</id>
		<title>Script bindings</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7062"/>
		<updated>2011-12-13T04:38:52Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Scripting Code::Blocks]]&lt;br /&gt;
Code::Blocks already has exposed a very large chunk of its SDK and wxWidgets stuff to scripts (see [[Scripting commands]]). How is the scripting binding done in C::B? What is required to do to add additional script binding of parts not (yet) exposed? This page is intended to clarify this question and help developers to add additional script bindings to C::B at source-code level. Using [http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html SqPlus], it's easy to bind most classes/functions. Readers might hopefully pick this up pretty fast.&lt;br /&gt;
&lt;br /&gt;
Basically, a look at the '''sdk/scripting/bindings/sc_*.cpp''' files will give a good overview (starting with the smaller files). '''sc_progress.cpp''' is the simplest and easiest to read basically. It binds only one method without parameters (and the ctor, of course). It is used in several of the examples below. &lt;br /&gt;
&lt;br /&gt;
Bindings are kept separated in logical units as: '''sc_consts''', '''sc_globals''', '''sc_wxtypes''', etc. So before binding something, think carefully where it belongs to (or needs a new unit).&lt;br /&gt;
&lt;br /&gt;
All the '''sc_*''' files have a &amp;quot;Register_XXX()&amp;quot; function that actually does the bindings. If a new '''sc_*''' file is created, this &amp;quot;Register&amp;quot; function has to be declared as &amp;quot;extern&amp;quot; in '''scriptbindings.cpp''' and also needs to be called from there too. Looking at the other &amp;quot;Register_&amp;quot; functions in '''scriptbindings.cpp''' should make that clear. So to e.g. use '''sc_util_dialogs.cpp''', it has to be declared as &amp;quot;extern void&amp;quot; in '''scriptbindings.cpp''' and called in &amp;quot;RegisterBindings&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Adding a class ==&lt;br /&gt;
&lt;br /&gt;
To create a script binding for the C++ class &amp;quot;ClassName&amp;quot; you need to call&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;ClassName&amp;gt;(&amp;quot;ScriptClassName&amp;quot;) &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Usually the same name for scripts is used as for the C++ side so &amp;quot;ClassName&amp;quot; in C++ is also bound as &amp;quot;ClassName&amp;quot; in scripts, e.g. &amp;lt;pre&amp;gt;SqPlus::SQClassDef&amp;lt;wxString&amp;gt;(&amp;quot;wxString&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a class to work correctly within a script it must also be declared in '''sc_base_types.h''', using the format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DECLARE_INSTANCE_TYPE(ClassName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you don't do this, any functions that are meant to return on object of your new class will be of type &amp;quot;USERPOINTER&amp;quot; rather than &amp;quot;INSTANCE&amp;quot;, and squirrel won't know that the class members belong to it. Hence in the script console you might see errors of the form&lt;br /&gt;
&lt;br /&gt;
  AN ERROR HAS OCCURED [the index 'ClassMember' does not exist]&lt;br /&gt;
  CALLSTACK&lt;br /&gt;
  *FUNCTION [GetModuleMenu()] C:\codeblocks\share\CodeBlocks\scripts\myscript.script line [35]&lt;br /&gt;
  LOCALS&lt;br /&gt;
  [myobject] USERPOINTER&lt;br /&gt;
  [data] INSTANCE&lt;br /&gt;
  [who] 2&lt;br /&gt;
  [this] INSTANCE&lt;br /&gt;
&lt;br /&gt;
Here the local variable &amp;quot;myobject&amp;quot; in the plugin script &amp;quot;myscript.script&amp;quot; was supposed to be an object, and its method &amp;quot;ClassMember&amp;quot; was called. However, the object type was not known (see the &amp;quot;[myobject] USERPOINTER&amp;quot; line in the list of locals - it should have been &amp;quot;[myobject] INSTANCE&amp;quot;), and so the call to myobject.ClassMember() was not recognized.&lt;br /&gt;
&lt;br /&gt;
=== Class members ===&lt;br /&gt;
&lt;br /&gt;
To bind member functions/variables the class methods of the SqClassDef class&lt;br /&gt;
is used. The easiest of all is &amp;quot;func&amp;quot; which binds a member function, e.g.,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;ProgressDialog&amp;gt;(&amp;quot;ProgressDialog&amp;quot;).&lt;br /&gt;
emptyCtor().&lt;br /&gt;
func(&amp;amp;ProgressDialog::Update, &amp;quot;Update&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, you can chain these methods together.&lt;br /&gt;
&lt;br /&gt;
The '''emptyCtor()''' is a C::B patch on SqPlus to manually add an empty (script) constructor for the object. Without this, this type of object can't be created in scripts. It would only be possible to get it as a return value of a function call or something. The '''func''' member binds the '''ProgressDialog::Update''' member function as &amp;quot;Update&amp;quot; member function on the script object. So, it's just a one-on-one binding and that's the easiest binding case.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' Not all bindings should have an '''emptyCtor()'''. For example, scripts should not have the ability to create, say, a new &amp;quot;cbProject&amp;quot;. Instead, it should go through the standard route: '''GetProjectManager().NewProject()'''. Another thing to note about '''emptyCtor()''' is that it imposes certain requirements on the C++ class, like that your C++ object ''must'' have a public copy constructor (but this is a requirement anyway). Look for an example in all basic classes (e.g., cbEditor). Copy constructors have been added to them which do nothing, just throw an error. They are not used by scripting (SqPlus has been patched for this) but they must exist nevertheless. Anyway, these are some&lt;br /&gt;
&amp;quot;advanced&amp;quot; scripting issues which will become clearer once the basics are more clear. All of the wxWidgets GUI controls have private copy-ctors btw.&lt;br /&gt;
&lt;br /&gt;
=== Function arguments ===&lt;br /&gt;
&lt;br /&gt;
In order to be able to use a registered type as a function's argument, this type must be declared in '''sc_base_types.h'''. It's pretty easy, just a macro. If the function to register will not be used as a function's parameter (or return value), then there is no need for that. So it's the '''DECLARE_INSTANCE_TYPE''' and '''DECLARE_ENUM_TYPE''' macro, depending on what shall be registered.&lt;br /&gt;
&lt;br /&gt;
=== Constructors with arguments ===&lt;br /&gt;
&lt;br /&gt;
This next example comes from '''sc_util_dialogs.cpp''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;EditPathDlg&amp;gt;(&amp;quot;EditPathDlg&amp;quot;).&lt;br /&gt;
    staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;).&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second line might look complex but it's really not. &amp;quot;staticFuncVarArgs&amp;quot; binds a squirrel C function to script (with variable arguments, as the name suggests). The first parameter is the C function  name, the second is the function's name in scripts. For constructors it is always &amp;quot;constructor&amp;quot;. The third parameter is a string saying what parameters this function accepts. &amp;quot;*&amp;quot; means anything and is used with &amp;quot;staticFuncVarArgs&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' If, instead of &amp;quot;*&amp;quot;, the parameter string had been something like &amp;quot;nnsn&amp;quot;, it would mean this function takes ([n]umber, [n]umber, [s]tring, [n]umber) parameters. Clever and with automatic type matching (means if types do not match a script exception is raised). In C::B that form isn't used - &amp;quot;*&amp;quot; is  always used. Because, for example, &amp;quot;string&amp;quot; is not the same as wxString that is constantly used. Anyway, it's not being used.&lt;br /&gt;
&lt;br /&gt;
In the example '''staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;)''' defines the custom ctor. Custom ctors must be bound to a squirrel callback which have the signature '''SQInteger FuncName(HSQUIRRELVM v)''', so in this case the callback is '''SQInteger EditPathDlg_Ctor(HSQUIRRELVM v)'''. &lt;br /&gt;
&lt;br /&gt;
In the C function that will act as the constructor all that needs to be done is to access the parameters and construct the object manually, using SqPlus methods to do it. When a script calls a function and it lands in a C function (like the one used above) it passes all arguments onto the stack (including &amp;quot;this&amp;quot; object, in case of global functions, &amp;quot;this&amp;quot; is the VM). Anyway, to read a function parameter squirrel gives the value at the appropriate place on the stack. Think of it as an array of parameters. So to read parameter three, ask for the value on the fourth place on the stack (remember that parameter 1 is &amp;quot;this&amp;quot;, so the second function parameter is at index 3). The &amp;quot;0&amp;quot; as first parameter in some functions is the NULL pointer for the wxWidgets parent (if required). &amp;quot;this&amp;quot; is never used because &amp;quot;this&amp;quot; is handled by SqPlus to call the member function on the correct object. &lt;br /&gt;
&lt;br /&gt;
Usually we only care about the actual parameters. &amp;quot;StackHandler&amp;quot; is a helper class to make it easy to access the stack. It has functions to get/set values on the stack like: &amp;quot;GetInt()&amp;quot;, &amp;quot;GetBool()&amp;quot;, etc. They all take the index as parameter. You can see this being used in '''SQInteger EditPairDlg_Ctor(HSQUIRRELVM v)''' within '''sc_util_dialogs.cpp'''.&lt;br /&gt;
&lt;br /&gt;
Also worth mentioning in the same function is this construct:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*SqPlus::GetInstance&amp;lt;wxString&amp;gt;(v, 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It gets access to an object address, not a primitive type. This actually returns the wxString object at stack index 2 because StackHandler is not aware of any types that is self-bound. It can't use it so the '''SqPlus::GetInstance''' helper function has to be used. The template parameter tells what type is there. The first parameter is the squirrel VM and the last parameter is the stack index. '''SqPlus::GetInstance''' always returns a pointer to the object, so it's dereferenced using (*) to access the actual object.&lt;br /&gt;
&lt;br /&gt;
All what's left for this section is '''SqPlus::PostConstruct'''. This is done to inform SqPlus about the new object. This will actually bind, e.g., the new EditPathDlg object that has been created to the script. Without it, just the object would be created in the C++ side. But a script is expecting to access that object - that function does that. It is provided with the dtor method because when Squirrel decides that this object needs to be garbage-collected, it calls a callback function to do this. It's a boilerplate function, nothing to it, really.&lt;br /&gt;
&lt;br /&gt;
=== Other bindings ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;staticFunc&amp;quot; is the same but a &amp;quot;static C function&amp;quot;. There is &amp;quot;var()&amp;quot; left but I guess this is clear by now: It's for public member variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overloaded Functions ==&lt;br /&gt;
&lt;br /&gt;
All &amp;quot;SqClassDef&amp;quot; member functions (like &amp;quot;func&amp;quot;) are actually template functions of style '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)'''. Suppose '''void foo::bar(int)''' ''and'' '''void foo::bar(float)''' are two overloads of the same function in C++ side. Trying to use the '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)''' binding will fail miserably because the compiler doesn't know which one to bind. In that case, &amp;quot;func&amp;quot; must be told which overload is the one to be used. This is done using a typedef. Assuming the usage of the (float) overload, here is what you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef void(*FOOBAR_FLOAT)(float);&lt;br /&gt;
func&amp;lt;FOOBAR_FLOAT&amp;gt;(&amp;amp;foo::bar, &amp;quot;bar&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final words ==&lt;br /&gt;
&lt;br /&gt;
Just remember one thing: Strive for simplicity! If you start on wx bindings, there is no need for every enum or function param that is used. Only add what's really required... not everything. This means e.g. for the wx control ctors, just what is necessary, as a matter of fact, no constructor for wx controls.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html Sq Plus page on Squirrel wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlusFAQ.html Sq Plus FAQ]&lt;br /&gt;
&lt;br /&gt;
[[Scripting commands]] lists the current script bindings to date.&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7059</id>
		<title>Script bindings</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7059"/>
		<updated>2011-12-12T08:45:50Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: Added link to list of current script bindings.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Scripting Code::Blocks]]&lt;br /&gt;
Code::Blocks already has exposed a very large chunk of its SDK and wxWidgets stuff to scripts (see [[Scripting commands]]). How is the scripting binding done in C::B? What is required to do to add additional script binding of parts not (yet) exposed? This page is intended to clarify this question and help developers to add additional script bindings to C::B at source-code level. Using [http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html SqPlus], it's easy to bind most classes/functions. Readers might hopefully pick this up pretty fast.&lt;br /&gt;
&lt;br /&gt;
Basically, a look at the '''sdk/scripting/bindings/sc_*.cpp''' files will give a good overview (starting with the smaller files). '''sc_progress.cpp''' is the simplest and easiest to read basically. It binds only one method without parameters (and the ctor, of course). It is used in several of the examples below. &lt;br /&gt;
&lt;br /&gt;
Bindings are kept separated in logical units as: '''sc_consts''', '''sc_globals''', '''sc_wxtypes''', etc. So before binding something, think carefully where it belongs to (or needs a new unit).&lt;br /&gt;
&lt;br /&gt;
All the '''sc_*''' files have a &amp;quot;Register_XXX()&amp;quot; function that actually does the bindings. If a new '''sc_*''' file is created, this &amp;quot;Register&amp;quot; function has to be declared as &amp;quot;extern&amp;quot; in '''scriptbindings.cpp''' and also needs to be called from there too. Looking at the other &amp;quot;Register_&amp;quot; functions in '''scriptbindings.cpp''' should make that clear. So to e.g. use '''sc_util_dialogs.cpp''', it has to be declared as &amp;quot;extern void&amp;quot; in '''scriptbindings.cpp''' and called in &amp;quot;RegisterBindings&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Adding a class ==&lt;br /&gt;
&lt;br /&gt;
To create a script binding for the C++ class &amp;quot;ClassName&amp;quot; you need to call&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;ClassName&amp;gt;(&amp;quot;ScriptClassName&amp;quot;) &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Usually the same name for scripts is used as for the C++ side so &amp;quot;ClassName&amp;quot; in C++ is also bound as &amp;quot;ClassName&amp;quot; in scripts, e.g. &amp;lt;pre&amp;gt;SqPlus::SQClassDef&amp;lt;wxString&amp;gt;(&amp;quot;wxString&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Class members ===&lt;br /&gt;
&lt;br /&gt;
To bind member functions/variables the class methods of the SqClassDef class&lt;br /&gt;
is used. The easiest of all is &amp;quot;func&amp;quot; which binds a member function, e.g.,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;ProgressDialog&amp;gt;(&amp;quot;ProgressDialog&amp;quot;).&lt;br /&gt;
emptyCtor().&lt;br /&gt;
func(&amp;amp;ProgressDialog::Update, &amp;quot;Update&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, you can chain these methods together.&lt;br /&gt;
&lt;br /&gt;
The '''emptyCtor()''' is a C::B patch on SqPlus to manually add an empty (script) constructor for the object. Without this, this type of object can't be created in scripts. It would only be possible to get it as a return value of a function call or something. The '''func''' member binds the '''ProgressDialog::Update''' member function as &amp;quot;Update&amp;quot; member function on the script object. So, it's just a one-on-one binding and that's the easiest binding case.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' Not all bindings should have an '''emptyCtor()'''. For example, scripts should not have the ability to create, say, a new &amp;quot;cbProject&amp;quot;. Instead, it should go through the standard route: '''GetProjectManager().NewProject()'''. Another thing to note about '''emptyCtor()''' is that it imposes certain requirements on the C++ class, like that your C++ object ''must'' have a public copy constructor (but this is a requirement anyway). Look for an example in all basic classes (e.g., cbEditor). Copy constructors have been added to them which do nothing, just throw an error. They are not used by scripting (SqPlus has been patched for this) but they must exist nevertheless. Anyway, these are some&lt;br /&gt;
&amp;quot;advanced&amp;quot; scripting issues which will become clearer once the basics are more clear. All of the wxWidgets GUI controls have private copy-ctors btw.&lt;br /&gt;
&lt;br /&gt;
=== Function arguments ===&lt;br /&gt;
&lt;br /&gt;
In order to be able to use a registered type as a function's argument, this type must be declared in '''sc_base_types.h'''. It's pretty easy, just a macro. If the function to register will not be used as a function's parameter (or return value), then there is no need for that. So it's the '''DECLARE_INSTANCE_TYPE''' and '''DECLARE_ENUM_TYPE''' macro, depending on what shall be registered.&lt;br /&gt;
&lt;br /&gt;
=== Constructors with arguments ===&lt;br /&gt;
&lt;br /&gt;
This next example comes from '''sc_util_dialogs.cpp''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;EditPathDlg&amp;gt;(&amp;quot;EditPathDlg&amp;quot;).&lt;br /&gt;
    staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;).&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second line might look complex but it's really not. &amp;quot;staticFuncVarArgs&amp;quot; binds a squirrel C function to script (with variable arguments, as the name suggests). The first parameter is the C function  name, the second is the function's name in scripts. For constructors it is always &amp;quot;constructor&amp;quot;. The third parameter is a string saying what parameters this function accepts. &amp;quot;*&amp;quot; means anything and is used with &amp;quot;staticFuncVarArgs&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' If, instead of &amp;quot;*&amp;quot;, the parameter string had been something like &amp;quot;nnsn&amp;quot;, it would mean this function takes ([n]umber, [n]umber, [s]tring, [n]umber) parameters. Clever and with automatic type matching (means if types do not match a script exception is raised). In C::B that form isn't used - &amp;quot;*&amp;quot; is  always used. Because, for example, &amp;quot;string&amp;quot; is not the same as wxString that is constantly used. Anyway, it's not being used.&lt;br /&gt;
&lt;br /&gt;
In the example '''staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;)''' defines the custom ctor. Custom ctors must be bound to a squirrel callback which have the signature '''SQInteger FuncName(HSQUIRRELVM v)''', so in this case the callback is '''SQInteger EditPathDlg_Ctor(HSQUIRRELVM v)'''. &lt;br /&gt;
&lt;br /&gt;
In the C function that will act as the constructor all that needs to be done is to access the parameters and construct the object manually, using SqPlus methods to do it. When a script calls a function and it lands in a C function (like the one used above) it passes all arguments onto the stack (including &amp;quot;this&amp;quot; object, in case of global functions, &amp;quot;this&amp;quot; is the VM). Anyway, to read a function parameter squirrel gives the value at the appropriate place on the stack. Think of it as an array of parameters. So to read parameter three, ask for the value on the fourth place on the stack (remember that parameter 1 is &amp;quot;this&amp;quot;, so the second function parameter is at index 3). The &amp;quot;0&amp;quot; as first parameter in some functions is the NULL pointer for the wxWidgets parent (if required). &amp;quot;this&amp;quot; is never used because &amp;quot;this&amp;quot; is handled by SqPlus to call the member function on the correct object. &lt;br /&gt;
&lt;br /&gt;
Usually we only care about the actual parameters. &amp;quot;StackHandler&amp;quot; is a helper class to make it easy to access the stack. It has functions to get/set values on the stack like: &amp;quot;GetInt()&amp;quot;, &amp;quot;GetBool()&amp;quot;, etc. They all take the index as parameter. You can see this being used in '''SQInteger EditPairDlg_Ctor(HSQUIRRELVM v)''' within '''sc_util_dialogs.cpp'''.&lt;br /&gt;
&lt;br /&gt;
Also worth mentioning in the same function is this construct:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*SqPlus::GetInstance&amp;lt;wxString&amp;gt;(v, 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It gets access to an object address, not a primitive type. This actually returns the wxString object at stack index 2 because StackHandler is not aware of any types that is self-bound. It can't use it so the '''SqPlus::GetInstance''' helper function has to be used. The template parameter tells what type is there. The first parameter is the squirrel VM and the last parameter is the stack index. '''SqPlus::GetInstance''' always returns a pointer to the object, so it's dereferenced using (*) to access the actual object.&lt;br /&gt;
&lt;br /&gt;
All what's left for this section is '''SqPlus::PostConstruct'''. This is done to inform SqPlus about the new object. This will actually bind, e.g., the new EditPathDlg object that has been created to the script. Without it, just the object would be created in the C++ side. But a script is expecting to access that object - that function does that. It is provided with the dtor method because when Squirrel decides that this object needs to be garbage-collected, it calls a callback function to do this. It's a boilerplate function, nothing to it, really.&lt;br /&gt;
&lt;br /&gt;
=== Other bindings ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;staticFunc&amp;quot; is the same but a &amp;quot;static C function&amp;quot;. There is &amp;quot;var()&amp;quot; left but I guess this is clear by now: It's for public member variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overloaded Functions ==&lt;br /&gt;
&lt;br /&gt;
All &amp;quot;SqClassDef&amp;quot; member functions (like &amp;quot;func&amp;quot;) are actually template functions of style '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)'''. Suppose '''void foo::bar(int)''' ''and'' '''void foo::bar(float)''' are two overloads of the same function in C++ side. Trying to use the '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)''' binding will fail miserably because the compiler doesn't know which one to bind. In that case, &amp;quot;func&amp;quot; must be told which overload is the one to be used. This is done using a typedef. Assuming the usage of the (float) overload, here is what you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef void(*FOOBAR_FLOAT)(float);&lt;br /&gt;
func&amp;lt;FOOBAR_FLOAT&amp;gt;(&amp;amp;foo::bar, &amp;quot;bar&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final words ==&lt;br /&gt;
&lt;br /&gt;
Just remember one thing: Strive for simplicity! If you start on wx bindings, there is no need for every enum or function param that is used. Only add what's really required... not everything. This means e.g. for the wx control ctors, just what is necessary, as a matter of fact, no constructor for wx controls.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html Sq Plus page on Squirrel wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlusFAQ.html Sq Plus FAQ]&lt;br /&gt;
&lt;br /&gt;
[[Scripting commands]] lists the current script bindings to date.&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Source_hierarchy&amp;diff=7058</id>
		<title>Source hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Source_hierarchy&amp;diff=7058"/>
		<updated>2011-12-12T05:35:37Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Developer Documentation]]&lt;br /&gt;
&lt;br /&gt;
=== Top-level layout ===&lt;br /&gt;
&lt;br /&gt;
The ''src'' folder within the SVN trunk directory [http://svn.berlios.de/wsvn/codeblocks/trunk/src/] contains the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
base        - ?? source for exchndl.dll, and tinyxml source&lt;br /&gt;
build_tools - ?? tools used within build process such as for included SVN revision number (not sure about scrooge)&lt;br /&gt;
i18n        - i18n (internationalization) support files&lt;br /&gt;
include     - header files for libcodeblocks, these headers are used by the plugins and the main application&lt;br /&gt;
mime        - mime-type files, icons and other metadata&lt;br /&gt;
plugins     - source for C::B plugins&lt;br /&gt;
scripts     - squirrel script files and associated support files&lt;br /&gt;
sdk         - cpp files for libcodeblocks, also all the bundled libs have been put here (wxscintilla, wxpropgrid, scripting)&lt;br /&gt;
src         - header and cpp files for the main executable&lt;br /&gt;
templates   - files relating to templates for different types of files and projects within C::B&lt;br /&gt;
tools       - Code for programs other than C::B&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Executable ===&lt;br /&gt;
The Codeblocks executable is built from ''src/src'', but most of the functionality is contained within libcodeblocks built from ''src/sdk''. The reason for this appears to be the need to avoid unresolved symbols in DLL files - a good explanation for the need for this can be found at [http://edll.sourceforge.net/#sub_dll]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* All plugins go into the ''src/plugins'' folder. &lt;br /&gt;
* Contrib and non-core plugins go into ''src/plugins/contrib/''&lt;br /&gt;
&lt;br /&gt;
=== Scripts ===&lt;br /&gt;
Resources for writing scripts as found in ''src/scripts'' can be found in [[Scripting Code::Blocks]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
Related forum discussion [/index.php/topic,15657.msg105327.html]&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Source_hierarchy&amp;diff=7057</id>
		<title>Source hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Source_hierarchy&amp;diff=7057"/>
		<updated>2011-12-11T03:18:31Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: Created page with &amp;quot;Category:Developer Documentation  The ''src'' within the SVN trunk directory [http://svn.berlios.de/wsvn/codeblocks/trunk/src/] contains the following sub-directories:  &amp;lt;pre&amp;gt;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Developer Documentation]]&lt;br /&gt;
&lt;br /&gt;
The ''src'' within the SVN trunk directory [http://svn.berlios.de/wsvn/codeblocks/trunk/src/] contains the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
base        - ?? source for exchndl.dll, and tinyxml source&lt;br /&gt;
build_tools - ?? tools used within build process such as for included SVN revision number (not sure about scrooge)&lt;br /&gt;
i18n        - i18n (internationalization) support files&lt;br /&gt;
include     - header files for libcodeblocks, these headers are used by the plugins and the main application&lt;br /&gt;
mime        - mime-type files, icons and other metadata&lt;br /&gt;
plugins     - source for C::B plugins&lt;br /&gt;
scripts     - squirrel script files and associated support files&lt;br /&gt;
sdk         - cpp files for libcodeblocks, also all the bundled libs have been put here (wxscintilla, wxpropgrid, scripting)&lt;br /&gt;
src         - header and cpp files for the main executable&lt;br /&gt;
templates   - files relating to templates for different types of files and projects within C::B&lt;br /&gt;
tools       - Code for programs other than C::B&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* All plugins go into the ''src/plugins'' folder. &lt;br /&gt;
* Contrib and non-core plugins go into ''src/plugins/contrib/''&lt;br /&gt;
&lt;br /&gt;
=== Scripts ===&lt;br /&gt;
Resources for writing scripts as found in ''src/scripts'' can be found in [[Scripting Code::Blocks]]&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7056</id>
		<title>Script bindings</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7056"/>
		<updated>2011-12-10T10:42:28Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: Attempted to add some structure to the page and clean up some of the text.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Scripting Code::Blocks]]&lt;br /&gt;
Code::Blocks already has exposed a very large chunk of its SDK and wxWidgets stuff to scripts. How is the scripting binding done in C::B? What is required to do to add additional script binding of parts not (yet) exposed? This page is intended to clarify this question and help developers to add additional script bindings to C::B at source-code level. Using [http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html SqPlus], it's easy to bind most classes/functions. Readers might hopefully pick this up pretty fast.&lt;br /&gt;
&lt;br /&gt;
Basically, a look at the '''sdk/scripting/bindings/sc_*.cpp''' files will give a good overview (starting with the smaller files). '''sc_progress.cpp''' is the simplest and easiest to read basically. It binds only one method without parameters (and the ctor, of course). It is used in several of the examples below. &lt;br /&gt;
&lt;br /&gt;
Bindings are kept separated in logical units as: '''sc_consts''', '''sc_globals''', '''sc_wxtypes''', etc. So before binding something, think carefully where it belongs to (or needs a new unit).&lt;br /&gt;
&lt;br /&gt;
All the '''sc_*''' files have a &amp;quot;Register_XXX()&amp;quot; function that actually does the bindings. If a new '''sc_*''' file is created, this &amp;quot;Register&amp;quot; function has to be declared as &amp;quot;extern&amp;quot; in '''scriptbindings.cpp''' and also needs to be called from there too. Looking at the other &amp;quot;Register_&amp;quot; functions in '''scriptbindings.cpp''' should make that clear. So to e.g. use '''sc_util_dialogs.cpp''', it has to be declared as &amp;quot;extern void&amp;quot; in '''scriptbindings.cpp''' and called in &amp;quot;RegisterBindings&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Adding a class ==&lt;br /&gt;
&lt;br /&gt;
To create a script binding for the C++ class &amp;quot;ClassName&amp;quot; you need to call&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;ClassName&amp;gt;(&amp;quot;ScriptClassName&amp;quot;) &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Usually the same name for scripts is used as for the C++ side so &amp;quot;ClassName&amp;quot; in C++ is also bound as &amp;quot;ClassName&amp;quot; in scripts, e.g. &amp;lt;pre&amp;gt;SqPlus::SQClassDef&amp;lt;wxString&amp;gt;(&amp;quot;wxString&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Class members ===&lt;br /&gt;
&lt;br /&gt;
To bind member functions/variables the class methods of the SqClassDef class&lt;br /&gt;
is used. The easiest of all is &amp;quot;func&amp;quot; which binds a member function, e.g.,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;ProgressDialog&amp;gt;(&amp;quot;ProgressDialog&amp;quot;).&lt;br /&gt;
emptyCtor().&lt;br /&gt;
func(&amp;amp;ProgressDialog::Update, &amp;quot;Update&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, you can chain these methods together.&lt;br /&gt;
&lt;br /&gt;
The '''emptyCtor()''' is a C::B patch on SqPlus to manually add an empty (script) constructor for the object. Without this, this type of object can't be created in scripts. It would only be possible to get it as a return value of a function call or something. The '''func''' member binds the '''ProgressDialog::Update''' member function as &amp;quot;Update&amp;quot; member function on the script object. So, it's just a one-on-one binding and that's the easiest binding case.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' Not all bindings should have an '''emptyCtor()'''. For example, scripts should not have the ability to create, say, a new &amp;quot;cbProject&amp;quot;. Instead, it should go through the standard route: '''GetProjectManager().NewProject()'''. Another thing to note about '''emptyCtor()''' is that it imposes certain requirements on the C++ class, like that your C++ object ''must'' have a public copy constructor (but this is a requirement anyway). Look for an example in all basic classes (e.g., cbEditor). Copy constructors have been added to them which do nothing, just throw an error. They are not used by scripting (SqPlus has been patched for this) but they must exist nevertheless. Anyway, these are some&lt;br /&gt;
&amp;quot;advanced&amp;quot; scripting issues which will become clearer once the basics are more clear. All of the wxWidgets GUI controls have private copy-ctors btw.&lt;br /&gt;
&lt;br /&gt;
=== Function arguments ===&lt;br /&gt;
&lt;br /&gt;
In order to be able to use a registered type as a function's argument, this type must be declared in '''sc_base_types.h'''. It's pretty easy, just a macro. If the function to register will not be used as a function's parameter (or return value), then there is no need for that. So it's the '''DECLARE_INSTANCE_TYPE''' and '''DECLARE_ENUM_TYPE''' macro, depending on what shall be registered.&lt;br /&gt;
&lt;br /&gt;
=== Constructors with arguments ===&lt;br /&gt;
&lt;br /&gt;
This next example comes from '''sc_util_dialogs.cpp''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SqPlus::SQClassDef&amp;lt;EditPathDlg&amp;gt;(&amp;quot;EditPathDlg&amp;quot;).&lt;br /&gt;
    staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;).&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second line might look complex but it's really not. &amp;quot;staticFuncVarArgs&amp;quot; binds a squirrel C function to script (with variable arguments, as the name suggests). The first parameter is the C function  name, the second is the function's name in scripts. For constructors it is always &amp;quot;constructor&amp;quot;. The third parameter is a string saying what parameters this function accepts. &amp;quot;*&amp;quot; means anything and is used with &amp;quot;staticFuncVarArgs&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' If, instead of &amp;quot;*&amp;quot;, the parameter string had been something like &amp;quot;nnsn&amp;quot;, it would mean this function takes ([n]umber, [n]umber, [s]tring, [n]umber) parameters. Clever and with automatic type matching (means if types do not match a script exception is raised). In C::B that form isn't used - &amp;quot;*&amp;quot; is  always used. Because, for example, &amp;quot;string&amp;quot; is not the same as wxString that is constantly used. Anyway, it's not being used.&lt;br /&gt;
&lt;br /&gt;
In the example '''staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;)''' defines the custom ctor. Custom ctors must be bound to a squirrel callback which have the signature '''SQInteger FuncName(HSQUIRRELVM v)''', so in this case the callback is '''SQInteger EditPathDlg_Ctor(HSQUIRRELVM v)'''. &lt;br /&gt;
&lt;br /&gt;
In the C function that will act as the constructor all that needs to be done is to access the parameters and construct the object manually, using SqPlus methods to do it. When a script calls a function and it lands in a C function (like the one used above) it passes all arguments onto the stack (including &amp;quot;this&amp;quot; object, in case of global functions, &amp;quot;this&amp;quot; is the VM). Anyway, to read a function parameter squirrel gives the value at the appropriate place on the stack. Think of it as an array of parameters. So to read parameter three, ask for the value on the fourth place on the stack (remember that parameter 1 is &amp;quot;this&amp;quot;, so the second function parameter is at index 3). The &amp;quot;0&amp;quot; as first parameter in some functions is the NULL pointer for the wxWidgets parent (if required). &amp;quot;this&amp;quot; is never used because &amp;quot;this&amp;quot; is handled by SqPlus to call the member function on the correct object. &lt;br /&gt;
&lt;br /&gt;
Usually we only care about the actual parameters. &amp;quot;StackHandler&amp;quot; is a helper class to make it easy to access the stack. It has functions to get/set values on the stack like: &amp;quot;GetInt()&amp;quot;, &amp;quot;GetBool()&amp;quot;, etc. They all take the index as parameter. You can see this being used in '''SQInteger EditPairDlg_Ctor(HSQUIRRELVM v)''' within '''sc_util_dialogs.cpp'''.&lt;br /&gt;
&lt;br /&gt;
Also worth mentioning in the same function is this construct:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*SqPlus::GetInstance&amp;lt;wxString&amp;gt;(v, 2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It gets access to an object address, not a primitive type. This actually returns the wxString object at stack index 2 because StackHandler is not aware of any types that is self-bound. It can't use it so the '''SqPlus::GetInstance''' helper function has to be used. The template parameter tells what type is there. The first parameter is the squirrel VM and the last parameter is the stack index. '''SqPlus::GetInstance''' always returns a pointer to the object, so it's dereferenced using (*) to access the actual object.&lt;br /&gt;
&lt;br /&gt;
All what's left for this section is '''SqPlus::PostConstruct'''. This is done to inform SqPlus about the new object. This will actually bind, e.g., the new EditPathDlg object that has been created to the script. Without it, just the object would be created in the C++ side. But a script is expecting to access that object - that function does that. It is provided with the dtor method because when Squirrel decides that this object needs to be garbage-collected, it calls a callback function to do this. It's a boilerplate function, nothing to it, really.&lt;br /&gt;
&lt;br /&gt;
=== Other bindings ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;staticFunc&amp;quot; is the same but a &amp;quot;static C function&amp;quot;. There is &amp;quot;var()&amp;quot; left but I guess this is clear by now: It's for public member variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overloaded Functions ==&lt;br /&gt;
&lt;br /&gt;
All &amp;quot;SqClassDef&amp;quot; member functions (like &amp;quot;func&amp;quot;) are actually template functions of style '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)'''. Suppose '''void foo::bar(int)''' ''and'' '''void foo::bar(float)''' are two overloads of the same function in C++ side. Trying to use the '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)''' binding will fail miserably because the compiler doesn't know which one to bind. In that case, &amp;quot;func&amp;quot; must be told which overload is the one to be used. This is done using a typedef. Assuming the usage of the (float) overload, here is what you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef void(*FOOBAR_FLOAT)(float);&lt;br /&gt;
func&amp;lt;FOOBAR_FLOAT&amp;gt;(&amp;amp;foo::bar, &amp;quot;bar&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final words ==&lt;br /&gt;
&lt;br /&gt;
Just remember one thing: Strive for simplicity! If you start on wx bindings, there is no need for every enum or function param that is used. Only add what's really required... not everything. This means e.g. for the wx control ctors, just what is necessary, as a matter of fact, no constructor for wx controls.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html Sq Plus page on Squirrel wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlusFAQ.html Sq Plus FAQ]&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7055</id>
		<title>Script bindings</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Script_bindings&amp;diff=7055"/>
		<updated>2011-12-10T09:03:54Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: Added a couple of useful links to SqPlus&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Scripting Code::Blocks]]&lt;br /&gt;
Code::Blocks already has exposed a very large chunk of its SDK and wxWidgets stuff to scripts. Well, but how is the scripting binding done in C::B? What is required to do to add additional script binding of parts not (yet) exposed? This page is intended to clarify this question and help developers to add additional script bindings to C::B at source-code level. Readers might hopefully pick this up pretty fast.&lt;br /&gt;
&lt;br /&gt;
Basically, a look at the '''sdk/scripting/bindings/sc_*.cpp''' files will give a good overview (starting with the smaller files). Using [http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html SqPlus], it's easy to bind most classes/functions.&lt;br /&gt;
&lt;br /&gt;
'''SqPlus::SQClassDef&amp;lt;ClassName&amp;gt;(&amp;quot;ScriptClassName&amp;quot;)''' creates a class script binding for the C++ class &amp;quot;ClassName&amp;quot;. Usually the same name for scripts is used as for the C++ side so &amp;quot;ClassName&amp;quot; in C++ is also bound as &amp;quot;ClassName&amp;quot; in scripts, e.g. '''SqPlus::SQClassDef&amp;lt;wxString&amp;gt;(&amp;quot;wxString&amp;quot;)'''.&lt;br /&gt;
&lt;br /&gt;
To bind member functions/variables the class methods of the SqClassDef class&lt;br /&gt;
is used. The easiest of all is &amp;quot;func&amp;quot; which binds a member function, e.g.&lt;br /&gt;
  SqPlus::SQClassDef&amp;lt;ProgressDialog&amp;gt;(&amp;quot;ProgressDialog&amp;quot;).&lt;br /&gt;
          emptyCtor().&lt;br /&gt;
          func(&amp;amp;ProgressDialog::Update, &amp;quot;Update&amp;quot;);&lt;br /&gt;
The '''emptyCtor()''' is a C::B patch on SqPlus to manually add an empty (script) constructor for the object. Without this, this type of object can't be created in scripts. It would only be possible to get it as a return value of a function call or something. The '''func''' member binds the '''ProgressDialog::Update''' member function as &amp;quot;Update&amp;quot; member function on the script object. So, it's just a one-on-one binding and that's the easiest binding case.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' Not all bindings should have an '''emptyCtor()'''. For example, scripts should not have the ability to create, say, a new &amp;quot;cbProject&amp;quot;. Instead, it should go through the standard route: '''GetProjectManager().NewProject()'''. Another thing to note about '''emptyCtor()''' is that it imposes certain requirements on the C++ class, like that your C++ object ''must'' have a public copy constructor (but this is a requirement anyway). Look for an example in all basic classes (eg. cbEditor). Copy constructors have been added to them which do nothing, just throw an error. They are not used by scripting (SqPlus has been patched for this) but they must exist nevertheless. Anyway, these are some&lt;br /&gt;
&amp;quot;advanced&amp;quot; scripting issues which will become clearer once the basics are more clear. All of the wxWidgets GUI controls have private copy-ctors btw.&lt;br /&gt;
&lt;br /&gt;
One important thing to note: In order to be able to use a registered type as a function's argument, this type must be declared in '''sc_base_types.h'''. It's pretty easy, just a macro. If the function to register will not be used as a function's parameter (or return value), then there is no need for that. So it's the '''DECLARE_INSTANCE_TYPE''' and '''DECLARE_ENUM_TYPE''' macro, depending on what shall be registered.&lt;br /&gt;
&lt;br /&gt;
Bindings are kept separated in logical units as: '''sc_consts''', '''sc_globals''', '''sc_wxtypes''', etc. So before binding something, think carefully where it belongs to (or needs a new unit).&lt;br /&gt;
&lt;br /&gt;
'''sc_progress.cpp''' is the simplest and easiest to read basically. It binds only one method without parameters (and the ctor, of course). Things get more complex only for two situations:&lt;br /&gt;
&lt;br /&gt;
1) constructors with arguments, and&lt;br /&gt;
2) overloaded functions&lt;br /&gt;
&lt;br /&gt;
Now we are looking at e.g. '''SqPlus::SQClassDef&amp;lt;EditPathDlg&amp;gt;(&amp;quot;EditPathDlg&amp;quot;).[...]'''. It might look complex but it's really not. '''staticFuncVarArgs(&amp;amp;EditPathDlg_Ctor, &amp;quot;constructor&amp;quot;, &amp;quot;*&amp;quot;)''': This is what defines the custom ctor. Custom ctors must be bound to a squirrel callback which have this signature: '''SQInteger FuncName(HSQUIRRELVM v)'''. That's '''SQInteger EditPathDlg_Ctor(HSQUIRRELVM v)'''.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;staticFuncVarArgs&amp;quot; binds a squirrel C function to script (with variable arguments, as the name suggests). The first parameter is the C function  name, the second is the function's name in scripts. For constructors it is always &amp;quot;constructor&amp;quot;. The third parameter is a string saying what parameters this function accepts. &amp;quot;*&amp;quot; means anything and&lt;br /&gt;
is used with &amp;quot;staticFuncVarArgs&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' If it was something like &amp;quot;nnsn&amp;quot;, it would mean this function takes ([n]umber, [n]umber, [s]tring, [n]umber) parameters. Clever and with automatic type matching (means if types do not match a script exception is raised). In C::B that form isn't used, there always &amp;quot;*&amp;quot; is used. Because, for example, &amp;quot;string&amp;quot; is not the same as wxString that is constantly used. Anyway, it's not being used.&lt;br /&gt;
&lt;br /&gt;
In the C function that will act as the constructor all to do now is to access the parameters and construct the object manually (using SqPlus methods to do it). When a script calls a function and it lands in a C function (like the one used above) it passes all arguments onto the stack (including &amp;quot;this&amp;quot; object, in case of global functions, &amp;quot;this&amp;quot; is the VM). Anyway, to read a function parameter squirrel gives the value at the appropriate place on the stack. Think of it as an array of parameters. So to read parameter three, ask for the value on the fourth place on the stack (remember that parameter 1 is &amp;quot;this&amp;quot;, so the second function parameter is at index 3). The &amp;quot;0&amp;quot; as first parameter in some functions is the NULL pointer for the wxWidgets parent (if required). &amp;quot;this&amp;quot; is never used because &amp;quot;this&amp;quot; is handled by SqPlus to call the member function on the correct object.&lt;br /&gt;
&lt;br /&gt;
Usually only the actual parameters are to care about. &amp;quot;StackHandler&amp;quot; is a helper class to make it easy to access the stack. It has functions to get/set values on the stack like: &amp;quot;GetInt()&amp;quot;, &amp;quot;GetBool()&amp;quot;, etc. They all take the index as parameter.&lt;br /&gt;
&lt;br /&gt;
One thing left is this construct: '''*SqPlus::GetInstance&amp;lt;wxString&amp;gt;(v, 2)'''. It gets access to an object address, not a primitive type. This actually returns the wxString object at stack index 2 because StackHandler is not aware of any types that is self-bound. It can't use it so the '''SqPlus::GetInstance''' helper function has to be used. The template parameter tells what type is there. The first parameter is the squirrel VM and the last parameter is the stack index. '''SqPlus::GetInstance''' always returns a pointer to the object, so it's dereferenced using (*) to access the actual object.&lt;br /&gt;
&lt;br /&gt;
All what's left for this section is '''SqPlus::PostConstruct'''. This is done to inform SqPlus about the new object. This will actually bind e.g. the new EditPathDlg object that has been created to the script. Without it, just the object would be created in the C++ side. But a script is expecting to access that object - that function does that. It is provided with the dtor method because when Squirrel decides that this object needs to be garbage-collected, it calls a callback function to do this. It's a biolerplate function, nothing to it, really.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;staticFunc&amp;quot; is the same but a &amp;quot;static C function&amp;quot;. There is &amp;quot;var()&amp;quot; left but I guess this is clear by now: It's for public member variables.&lt;br /&gt;
&lt;br /&gt;
One more thing to explain: &amp;quot;Function overloads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
All &amp;quot;SqClassDef&amp;quot; member functions (like &amp;quot;func&amp;quot;) are actually template functions of style '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)'''. Suppose '''void foo::bar(int)''' ''and'' '''void foo::bar(float)''' are two overloads of the same function in C++ side. Trying to use the '''func(&amp;amp;foo:bar, &amp;quot;bar&amp;quot;)''' binding will fail miserably because the compiler doesn't know which one to bind. In that case, &amp;quot;func&amp;quot; mus be told which overload is the one to be used. This is done using a typedef. Assuming the usage of the (float) overload, here is what's to do:&lt;br /&gt;
&lt;br /&gt;
  typedef void(*FOOBAR_FLOAT)(float);&lt;br /&gt;
  func&amp;lt;FOOBAR_FLOAT&amp;gt;(&amp;amp;foo::bar, &amp;quot;bar&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
All these '''sc_*''' files, have a &amp;quot;Register_XXX()&amp;quot; function that actually does the bindings. If a new '''sc_*''' file is created, this &amp;quot;Register&amp;quot; function has to be declared as &amp;quot;extern&amp;quot; in '''scriptbindings.cpp''' and also needs to be called from there too. Looking at the other &amp;quot;Register_&amp;quot; functions in '''scriptbindings.cpp''' should make that clear. So to e.g. use '''sc_util_dialogs.cpp''', it has to be declared as &amp;quot;extern void&amp;quot; in '''scriptbindings.cpp''' and called in &amp;quot;RegisterBindings&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Just remember one thing: Strive for simplicity! If you start on wx bindings, there is no need for every enum or function param that is used. Only add what's really required... not everything. This means e.g. for the wx control ctors, just what is necessary, as a matter of fact, no constructor for wx controls.&lt;br /&gt;
&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html Sq Plus page on Squirrel wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlusFAQ.html Sq Plus FAQ]&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows&amp;diff=7054</id>
		<title>Installing Code::Blocks from source on Windows</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows&amp;diff=7054"/>
		<updated>2011-12-09T05:58:20Z</updated>

		<summary type="html">&lt;p&gt;Beldaz: Added fix for failed linking due to exported inlines&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installing Code::Blocks]]&lt;br /&gt;
[[Category:Installing Code::Blocks from source]]&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
=== Note for RC2 users ===&lt;br /&gt;
&lt;br /&gt;
The older Code::Blocks RC2 does not support global compiler variables which were added after RC2 was released and is unable to read project files generated with post-RC2 versions.&lt;br /&gt;
To build Code::Blocks, you need a post-RC2 build, such as ''8.02'' or any of the ''nightly builds'' obtainable by [/index.php?board=20.0 searching the forum].&lt;br /&gt;
&lt;br /&gt;
=== MinGW compiler ===&lt;br /&gt;
&lt;br /&gt;
At the present time, Code::Blocks only compiles successfully with the MinGW compiler (or any other gcc for that matter). You will need a complete, working [[MinGW installation]] or [http://www.tdragon.net/recentgcc/ TDM-MinGW package GCC 4.4.1]. &lt;br /&gt;
&lt;br /&gt;
'''Do not''' use the barebones MinGW with GCC 4.5.1 as you'll run (with this specific version) into [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601 a linker bug] (which happened to me on Vista SP1 32-bit on 2011-02-28); the solution is to use the TDM-GCC 4.5.1 package.&lt;br /&gt;
&lt;br /&gt;
=== wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
[http://www.wxwidgets.org/ wxWidgets.org]&lt;br /&gt;
&lt;br /&gt;
Code::Blocks uses&lt;br /&gt;
* since 28 March 2009 wxWidgets 2.8.10 &amp;lt;br/&amp;gt;Download: [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.10.zip wxMSW-2.8.10.zip]&lt;br /&gt;
&lt;br /&gt;
* since 18 October 2008 wxWidgets 2.8.9 &amp;lt;br/&amp;gt;Download: [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.9.zip wxMSW-2.8.9.zip]&lt;br /&gt;
&lt;br /&gt;
* since 19 July 2008 wxWidgets 2.8.8 &amp;lt;br/&amp;gt;Download: [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.8.zip wxMSW-2.8.8.zip]&lt;br /&gt;
&lt;br /&gt;
* since 28 November 2007 wxWidgets 2.8.7 &amp;lt;br/&amp;gt;Download: [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.7.zip wxMSW-2.8.7.zip]&lt;br /&gt;
&lt;br /&gt;
* since November 2007 wxWidgets 2.8.6 &amp;lt;br/&amp;gt;Download: [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.6.zip wxMSW-2.8.6.zip]&lt;br /&gt;
&lt;br /&gt;
* since May 2007 wxWidgets 2.8.4&amp;lt;br/&amp;gt;Download: [http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.4.zip wxMSW-2.8.4.zip]&lt;br /&gt;
&lt;br /&gt;
For latest infos check forum: [/index.php?topic=3299.0 Important changes to the nightly builds]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You do ''not'' need MSYS (''in fact, if you have MSYS, make sure it is not in your PATH when building wxWidgets'').&lt;br /&gt;
&lt;br /&gt;
=== SVN client ===&lt;br /&gt;
&lt;br /&gt;
In order to check out the Code::Blocks sources you will need a SVN client.&lt;br /&gt;
For convenience, it is recommended that you install [http://tortoisesvn.net/downloads TortoiseSVN] on your machine, as this is a lot more comfortable. However, if you get a bad feeling when some program is messing with your Explorer menu, then you can use the [http://subversion.tigris.org/project_packages.html svn command-line client] equally well.&lt;br /&gt;
&lt;br /&gt;
It is generally a good idea to install the command-line client (and adding it to PATH) even if you use TortoiseSVN for convenience. The &amp;lt;tt&amp;gt;autorevision&amp;lt;/tt&amp;gt; tool which is used during the build of Code::Blocks makes use of the &amp;lt;tt&amp;gt;svn&amp;lt;/tt&amp;gt; binary if it is available. This is preferable to the manual parsing of the entries file that is used as fall-back.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please do note that working copies checked out with the 1.4 version of Subversion are no longer compatible with earlier versions (Subversion will transparently update existing repositories).&lt;br /&gt;
&lt;br /&gt;
The built-in fall-back mechanism in &amp;lt;tt&amp;gt;autorevision&amp;lt;/tt&amp;gt; has been updated to the new 1.4 format and will no longer work with the old format.&amp;lt;br&amp;gt;&lt;br /&gt;
Therefore, if you use a Subversion client from the 1.0-1.3 line, you ''must'' put the command line tool into &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; for a successful build.&amp;lt;br&amp;gt;&lt;br /&gt;
If you use Subversion 1.4, then it is good practice nevertheless, but you can do without, too.&lt;br /&gt;
&lt;br /&gt;
=== svn.exe ===&lt;br /&gt;
If you want to show the SVN number in your code::blocks dialog box.&lt;br /&gt;
&lt;br /&gt;
[[Image:Svn number.png|300*300px]]&lt;br /&gt;
&lt;br /&gt;
You should also let svn.exe exist in the PATH of your windows system.&lt;br /&gt;
A command line SVN package can be download here [http://www.open.collab.net/downloads/subversion/ CollabNet Subversion Command-Line Client v1.6 (for Windows)].&lt;br /&gt;
&lt;br /&gt;
=== zip.exe ===&lt;br /&gt;
&lt;br /&gt;
You'll also need a working 'zip' program.&lt;br /&gt;
If you have the version listed on our [[MinGW installation#Other developer tools|tools page]], you'll be fine.&lt;br /&gt;
&lt;br /&gt;
The zip program coming with cygwin will ''not'' work properly. You do ''not'' need WinZip.&lt;br /&gt;
&lt;br /&gt;
Make sure the zip binary is in your PATH so the &amp;lt;tt&amp;gt;update.bat&amp;lt;/tt&amp;gt; script will be able to find it (alternatively, you can edit the batch file, setting the ZIPCMD variable to something else).&lt;br /&gt;
&lt;br /&gt;
The easiest way is to put zip.exe into &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt; inside your MinGW installation directory (that folder is normally in the path).&lt;br /&gt;
&lt;br /&gt;
=== Code::Blocks sources ===&lt;br /&gt;
&lt;br /&gt;
You will also (obviously) need the Code::Blocks sources. &lt;br /&gt;
&lt;br /&gt;
Using ''TortoiseSVN'', make a folder where you want to store the sources, right-click on the folder, and select &amp;quot;SVN Checkout...&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Win svn checkout.png]]&lt;br /&gt;
&lt;br /&gt;
In the top box, enter svn://svn.berlios.de/codeblocks/trunk and hit the OK button.&lt;br /&gt;
&lt;br /&gt;
Using ''svn'', you have to open a command prompt (&amp;quot;DOS Window&amp;quot;). Make a folder, change directory, and run svn:&lt;br /&gt;
&lt;br /&gt;
 mkdir codeblocks-head&lt;br /&gt;
 cd codeblocks-head&lt;br /&gt;
 svn checkout &amp;lt;nowiki&amp;gt;svn://svn.berlios.de/codeblocks/trunk&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Unicode Build ==&lt;br /&gt;
&lt;br /&gt;
=== Compile wxWidgets in Unicode mode ===&lt;br /&gt;
&lt;br /&gt;
After unpacking the zip file to a directory of your choice, open a cmd prompt, and navigate to the folder build/msw inside the wxWidgets folder. Use the following commands to compile wxWidgets:&lt;br /&gt;
&lt;br /&gt;
 set path=c:\mingw\bin;c:\mingw\mingw32\bin&lt;br /&gt;
 mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1  clean&lt;br /&gt;
 mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1&lt;br /&gt;
&lt;br /&gt;
This assumes your MinGW installation is in C:\mingw. Use a different path if you installed MinGW somewhere else.&lt;br /&gt;
&lt;br /&gt;
You will see a lot of warning messages during compilation. Don't worry, this is normal, you are compiling wxWidgets. The build process may take 10-30 minutes, depending on your computer's speed.&lt;br /&gt;
&lt;br /&gt;
If you are using a recent version of MinGW you may find that the object files are too large and that the linker runs out of memory. To fix this problem you need to edit config.gcc so that inline functions are not exported, by modifying the CFLAGS and CXXFLAGS lines to:&lt;br /&gt;
&lt;br /&gt;
  CFLAGS ?= -fno-keep-inline-dllexport&lt;br /&gt;
&lt;br /&gt;
  CXXFLAGS ?= -fno-keep-inline-dllexport&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''remark: If you want to use wxWidgets not only for building Code::Blocks, but also for writing wxWidgets programs, and if you want to use the debugger in those programs, you have to compile a debug build of wxWidgets as well.''&lt;br /&gt;
''Use the same commands as for the release build, but replace &amp;quot;release&amp;quot; by &amp;quot;debug&amp;quot;.''&lt;br /&gt;
&lt;br /&gt;
'''Optional:'''&lt;br /&gt;
&lt;br /&gt;
To reduce the size of your wxWidgets library, you can disable features which are not used by Code::Blocks. However, you should not do this unless you know what you are doing. You have to delete the generated setup.h from lib/gcc_dll/msw/wx before building, because your changes to include/wx/msw will otherwise not be honoured.&lt;br /&gt;
&lt;br /&gt;
=== Compile Code::Blocks ===&lt;br /&gt;
Now, before this step, you have prepared all the stuff to build code::blocks. It's very interesting that we use code::blocks to build code::blocks binaries.&lt;br /&gt;
&lt;br /&gt;
==== Open project====&lt;br /&gt;
Open the project file '''CodeBlocks.cbp'''. You will be prompted to define the global variable $(#wx). Enter the location where you unpacked wxWidgets.&lt;br /&gt;
&lt;br /&gt;
[[Image:Global_variable.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Global_variable2.png]]&lt;br /&gt;
&lt;br /&gt;
====Compile project====&lt;br /&gt;
Hit the blue gear and lean back. Compilation may take 3-5 minutes, depending on the speed of your computer.&lt;br /&gt;
&lt;br /&gt;
[[Image:Win build button.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Win build target.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Win build finish.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Copy wxWidgets support DLL====&lt;br /&gt;
After the compilation has finished, copy &amp;lt;tt&amp;gt;lib\gcc_dll\wxmsw28u_gcc_custom.dll&amp;lt;/tt&amp;gt; from the wxWidgets directory to the &amp;lt;tt&amp;gt;src\devel&amp;lt;/tt&amp;gt; directory inside the Code::Blocks source folder (it will also work if you keep a copy of that library in your Windows folder or anywhere in your system path, but this is generally not recommended because you can get into dll hell).&lt;br /&gt;
&lt;br /&gt;
[[Image:Win output folder.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Win copy dll.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Runing script file====&lt;br /&gt;
Run &amp;lt;tt&amp;gt;src\update.bat&amp;lt;/tt&amp;gt; (located in the root source directory). This will pack the resource files and copy libraries and plugins to their correct locations.&lt;br /&gt;
&lt;br /&gt;
[[Image:Win run bat.png]]&lt;br /&gt;
&lt;br /&gt;
The stripped (&amp;quot;production&amp;quot;) executable is found in &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; folder together with all libraries and data files. If you want a version with debug symbols instead (caution: huge size!), use the one found in the &amp;lt;tt&amp;gt;devel&amp;lt;/tt&amp;gt; folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Congratulations, you own a freshly built version of Code::Blocks!&lt;br /&gt;
&lt;br /&gt;
[[Image:Win final folder.png]]&lt;br /&gt;
&lt;br /&gt;
====Note for future updates====&lt;br /&gt;
Go to the Code::Blocks root directory and run &amp;lt;tt&amp;gt;svn update&amp;lt;/tt&amp;gt; (or use TurtoiseSVN to the same effect).&amp;lt;br/&amp;gt;&lt;br /&gt;
Then open and build the project as described before (and any contrib plugins that you wish to use), and re-run &amp;lt;tt&amp;gt;src\update.bat&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Install Code::Blocks ===&lt;br /&gt;
&lt;br /&gt;
Copy the folder output to where you want Code::Blocks to reside.&lt;br /&gt;
&lt;br /&gt;
=== Compile contributed (or your own) plugins ===&lt;br /&gt;
&lt;br /&gt;
The workspace file '''ContribPlugins.workspace''' contains the project files for all contributed plugins. Open that workspace and compile the plugins which you would like to use (or select &amp;quot;Build Workspace&amp;quot; from the context menu if you want them all).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:Contribute plugin.png]]&lt;br /&gt;
&lt;br /&gt;
When you open the contrib plugins workspace, you will be asked to define the &amp;lt;tt&amp;gt;$(#cb)&amp;lt;/tt&amp;gt; global compiler variable. This is the path that contains the sdk folder normally this is codeblocks\src. The build process uses this information to place the plugins and data files into the correct place. Enter the location of the Code::Blocks sources in the same way as for the &amp;lt;tt&amp;gt;$(#wx)&amp;lt;/tt&amp;gt; variable earlier.&lt;br /&gt;
&lt;br /&gt;
Don't forget to run update.bat again after building the contrib plugins.&lt;br /&gt;
&lt;br /&gt;
== ANSI Build ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #f7d9d9; border: 1px solid #000&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin: 5px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DEPRECATION WARNING: ====&lt;br /&gt;
As of February 2006, the official default build for Code::Blocks is '''Unicode''' (see above). Although ANSI builds are technically possible, we discourage their use unless there is a good reason.&amp;lt;br/&amp;gt;&lt;br /&gt;
''Support for ANSI builds is likely to be dropped after Version 1.0 is out.''&lt;br /&gt;
&lt;br /&gt;
There is hardly any good argument against using a Unicode build if your OS supports Unicode, even if you do not understand any other language than English, as a Unicode version guarantees that it will be able to work with whatever languages you may possibly encounter in the future -- at a very reasonable cost.&lt;br /&gt;
&lt;br /&gt;
However, if you absolutely don't care about Unicode or if you are bound to use Windows 95, then you may want to build an ANSI version nevertheless.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Compile wxWidgets in ANSI mode ====&lt;br /&gt;
&lt;br /&gt;
After unpacking the zip file to a directory of your choice, open a cmd prompt, and navigate to the folder build/msw inside the wxWidgets folder. Use the following commands to compile wxWidgets&lt;br /&gt;
&lt;br /&gt;
 set path=c:\mingw\bin;c:\mingw\mingw32\bin&lt;br /&gt;
 mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 clean&lt;br /&gt;
 mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0&lt;br /&gt;
&lt;br /&gt;
This assumes your MinGW installation is in C:\mingw. Use a different path if you installed MinGW somewhere else.&lt;br /&gt;
&lt;br /&gt;
You will see a lot of warning messages during compilation. Don't worry, this is normal, you are compiling wxWidgets. The build process may take 10-30 minutes, depending on your computer's speed.&lt;br /&gt;
&lt;br /&gt;
'''Optional:'''&lt;br /&gt;
&lt;br /&gt;
To reduce the size of your wxWidgets library, you can disable features which are not used by Code::Blocks. However, you should not do this unless you know what you are doing. You have to delete the generated setup.h from lib/gcc_dll/msw/wx before building, because your changes to include/wx/msw will otherwise not be honoured.&lt;br /&gt;
&lt;br /&gt;
==== Compile Code::Blocks ====&lt;br /&gt;
&lt;br /&gt;
Open the project CodeBlocks.cbp. You will be prompted to define the global variable $(#wx) if you have not used it before. Enter the location where you unpacked wxWidgets.&lt;br /&gt;
&lt;br /&gt;
'''Important:'''  The project file is set to compile an Unicode version of Code::Blocks by default. To make an ANSI build, you have to make the following two changes to build options before compiling:&lt;br /&gt;
1. In the &amp;quot;Compiler&amp;quot; tab, under &amp;quot;#defines&amp;quot;, remove the entry wxUSE_UNICODE.&lt;br /&gt;
2. Under &amp;quot;Custom variables&amp;quot;, set the variable WX_SUFFIX to empty (default value: u).&lt;br /&gt;
&lt;br /&gt;
Hit the blue gear and lean back. Compilation may take 3-5 minutes, depending on the speed of your computer.&lt;br /&gt;
&lt;br /&gt;
After the compilation has finished, copy wxmsw28u_gcc_custom.dll from lib\gcc_dll inside the wxWidgets directory to the devel directory inside the Code::Blocks source folder (it will also work if you keep a copy of that library in your Windows folder or anywhere in your system path, but this is generally not recommended because you can get into [[wikipedia:DLL Hell|dll hell]]).&lt;br /&gt;
Run update.bat (located in the root source directory). This will pack the resource files and copy libraries and plugins to their correct locations.&lt;br /&gt;
The location of executable is src\output in C::B tree. From here you'll not need the nightly build anymore.&lt;br /&gt;
&lt;br /&gt;
One little note for svn updates and rebuilds : just go into the codeblocks root directory and do '''svn update''' (or use Turtoise svn).&lt;br /&gt;
&lt;br /&gt;
Then run the src/output/codeblocks.exe, reload project, build it, reload plugins workspace, build it, quit codeblocks and re-run update.bat. You'll have an up-to-date C::B in 3 minutes !&lt;br /&gt;
&lt;br /&gt;
==== Install Code::Blocks ====&lt;br /&gt;
&lt;br /&gt;
Copy the folder output to where you want Code::Blocks to reside.&lt;br /&gt;
&lt;br /&gt;
==== Compile contributed (or your own) plugins ====&lt;br /&gt;
&lt;br /&gt;
The workspace file ContribPlugins.workspace contains the project files for all contributed plugins. Open that workspace and compile the plugins which you would like to use (or select &amp;quot;Build Workspace&amp;quot; from the context menu if you want them all). Don't forget to run update.bat again after building the contrib plugins.&lt;br /&gt;
&lt;br /&gt;
Note that the Nassi Shneiderman plugin (part of the contrib plugins) has a dependency on [http://www.boost.org boost] which is needed to compile this plugin. Boost does not need to be compiled therefore.&lt;/div&gt;</summary>
		<author><name>Beldaz</name></author>
	</entry>
</feed>