How to add code into Swig wrapper for C++ class constructor, targeting Ruby

Ok i know it’s a big title … but it describes the problem.

Lets say that you have a C++ class and you wrap it using swig. Now you decide to inject some code of your own into the constructor wrapper. If you try defining a typemap(out) you will not succeed. Instead the way to do it is this:

%module test


Β #include “MyClass.h”



%feature(“ref”) MyClass ” Here between the quotes add your code ”


%include “MyClass.h”


Well that’s it. Let me note, in case you are not aware, that the above code should go inside the *.i file that will be parsed by swig. You have now managed adding extra code into the _wrap_new_MyClass function that wraps the costructor of your class. Keep in mind that the above solution goes if you are targeting Ruby. Perhaps for other scripting languages you can add code into contructor wrapper function using %typemap(out) MyClass*, but that doesn’t work for Ruby. The above case is valid for swigwin-1.3.27 that i use currently.

Keep coding.


How to use LoadResData in VB .Net

If you need badly to use LoadResData in .Net VB you will have to use the VisualBasic.Compatibility namespace. This also applies to otherΒ VB6 functions that areΒ notΒ supported in .Net VB any more.

First of all right clickΒ onΒ your project in the solution explorer pane. Choose add reference and in the tab named .NET choose the ‘Microsoft Visual Basic .Net Compatibility’ and press select button. Then press ok.

Now write Microsoft.VisualBasic.Compatibility.VB6.LoadResData (…) and do whatever you want. If you don’t want to constantly write all the above extremely long line you can go to your project’s properties, select Common Properties->imports on the left window and add the namespace Microsoft.VisualBasic.Compatibility.VB6 into your project. After that you can directly write LoadResData(…)

Firebolt 0.3v on the way

Ok. Firebolt is ready again for major changes. Next releaseΒ willΒ be 0.3v which will not be refactored dramatically again (lets hope). It has been a little unpleasant geting breaking changes with each new release.

EasySockets is the new feature as you already know. It is a simple mini socket api. It is asynchronous in receiving data. It is synchronous in sending. It also supports sending packets. So if you tryΒ to send a packet of 1K size then the other socket will receive an OnRead event with exactly 1K size of data. This is not quaranteed by the Tcp/ip protocol, since it is a stream protocol. If you send 1K data using tcp/ip it is not quaranteed that the receiver will get it all with one recv() and not in 3 or more portions of various sizes.

Thus after a lot of troubles Firebolt 0.3v will beΒ even more robust and reliable.

Visual studio setup projects

Here is a usefull link for all those who make deployment (setup) projects using visual studio.Β

It is a list of properties that can be used for Launch conditions.

Based on the above info i will give you an example.Β If you want to create an installer that only the administrator will execute, you can create a launch condition and in it’s property ‘Condition’ place ”AdminUser” (without the quotes). If you read the above link you will know that AdminUser is true if the current user executing the installer is an administrator. If this condition fails then a dialog box appears containing the error message that you provided in the property Message.



Wellcome websurfer. What brought you here? Speak your mind. Hehe just kidding… This is my very recent homepage so enjoy. I try udpate things as soon as i can.