Last update March 7, 2012

Dwith Swig



Difference (last change) (no other diffs, normal page display)

Deleted: 136,246d135
jam tangan
jam tangan murah
jam tangan kw
hostgator coupon
kata mutiara
Jasa SEO
EZido
RDAnet
pioneer deh-1300mp
asus a53e-xa2
asus tf101-b1
asus tf101-a1
asus n53sv-eh72
asus republic of gamers g74sx
asus acer a5250
acer chromebook ac700
asus asus 53u
lg infinia 55lw5600
Sonicview 360 premier
asus 7 cu ft freezer
asus 30 single wall oven
brother cs6000i sewing machine
brother 1034d serger
brother sewing machines
Yokohama Geolandar H/T-S
crib tent tots in mind
kidco peapod plus
foscam fi8910w
samsung pl120 review
gopro helmet cam
Canon SX130IS
powershot s100
ContourHD 1080p
canon vixia hf r21
digital picture frame
canon ef 50mm f1.4
canon ef 70-300mm review
wide angle lenses
moving comfort sports bra
moving comfort bra
womens argyle sweater
bebe dresses
ViewSonic VX2250WM
Le Pan TC 970
Apple MacBook Air MC965LL
Sennheiser CX 880
plantronics cs540
ultrasonic jewelry cleaner
Sennheiser RS120
bose quietcomfort 15 acoustic noise cancelling headphones
logitech harmony one remote
logitech harmony 900
sony mhc-ec69i
sony mhcec909ip
bose wave music system
sony htss380
logitech squeezebox touch
sony dvp-fx970
onkyo tx-nr509
onkyo tx - nr609
onkyo ht-s3400
energy 5.1 take classic home theater system
polk audio psw505
onkyo ht-s5400
onkyo tx-nr709
belkin pf60
onkyo ht-rc360
denon avr-1912
Yamaha YHT-S400BL
fujitsu scansnap s1500
brother hl-2270dw
epson workforce 545
hp laserjet p2055dn
bushnell 8mp trophy cam
toshiba 32c110u
panasonic viera tc-p60s30
VIZIO E220VA
hauppauge wintv dcr-2650
Acer AM3970-U5022
Acer AspireRevo AR3700-U3002
Dell Inspiron i570
Dell GX620
Gateway FX6860-UR20P
Western Digital My Passport Essential SE 1 TB USB 3.0
Fujitsu ScanSnap S1300
Epson Perfection V300
Fujitsu SCANSNAP S1100
NeatDesk Desktop Scanner and Digital Filing System
Epson WorkForce Pro GT-S50
Kodak P811BK
Epson Perfection V330
Viewsonic VX2453MH
Asus VE228H
ViewSonic VA2431WM
Samsung B2230
HP 2711x
ASUS ML228H
Epson PowerLite Home Cinema 8350
Optoma PK301
Epson EX7210
Epson EX5210
ViewSonic PJD5133
Acer X1161P
FAVI RioHD-LED-2
Epson EX3210
ViewSonic PJD6531w
Trinity 360 Breville 800JEXL
Skil 3320-02
Delta 46-460
Grizzly G0555
Delta 18-900L

ToDo:Most of this page is obsolete since SWIG officially includes support for D now. NG announcement Blog post

Table of contents of this page
Introduction   
Modification to wrap C++ classes   
The changes so far   
Problem   
Implementation   
Wrapped classes   
Plans (To Do List)   
/Examples   
/Messages   
Discussion   
Uploads   
End   
Read this - important update   
New release   
Dsource Project   

Introduction    

SWIG is a program for automatic generation of interfaces to enable other languages to access code written in C or C++. There is a version contributed by Andy Friesen which has a module within it to generate an interface between D and C or C++. SWIG will run under Windows and also under Linux. There are considerable advantages to doing things in this way. The existing headers from either C or C++ can be called from an interface file, which defines the operations to be made available in the target language. A good deal of this is common to interfaces for different target languages, although it is easy to accomodate differences if necessary. The SWIG program uses the interface file as data to generate an interface program automatically, so that if there is a change in the interface it does not have to be recoded. In the cases of D, SWIG generates class interfaces in D which can be called from the application written in D, and which in turn call an interface code which has C linkage, even if the underlying program is in C++. In this way the D program does not need to access any code written in C++, and therefore does not need to use any C++ namemangling directly.

/MoreAboutSwig

Modification to wrap C++ classes    

I have been modifying the distributed version in order to improve the performance and above all avoid any need to make manual alterations to the code generated by SWIG. Note that the code generator for D was adapted from code originally written for Java and then adapted for C#. The code generated includes a separate file in D for each class which has been interfaced. One problem I encountered was the fact that the classes wrapped often referred to each other and in that case some means of importing the definition of one into another is needed

The changes so far    

  • Remove some places where type "char*" was replaced by "string". I have retained "char*".
  • Add a means to put extra lines "import Classname;" into the D files for individual classes.
  • I have also solved the resulting problem of the name of the class file (see /Problem ).
  • Add a means of dealing with the things which SWIG does not understand e.g. pointers.
  • Added support for C++ functions not in a class.
Details of /Modifications . See also /Examples/Function /Examples/Class .

Problem    

The above is not sufficient. There are some things which work when two classes are in the same file, but not if they are in separate files, as in the case of these generated by SWIG.

Details of /Problem and its solution. See also /Examples/Pragma

Implementation    

There needs to be a discussion of the different possibilities of the use of SWIG for D under /Linux and /Windows

Wrapped classes    

qd is a class for extended precision calculations (double double and quadruple double) to be found at the web site of Yozo Hida.

GiNaC is a C++ library for algebra. This is one of the reasons I latched onto SWIG for D.

Plans (To Do List)    

  • I am planning to test these modifications and then pass them back to Andy Friesen for inclusion in his distribution. Alternatively, I could distribute my modifications to his distribution (2 files) plus some examples separately.
  • I also have some plans to wrap some more classes, e.g. for symbolic algebra.
  • I want to look at wrapping STL objects such as string, vector and map which I guess will relate to the DTL I have seen mentioned. I have used these in my use of SWIG for Ruby, where there is a good interface.
  • I regard this work as only partially complete. Trying out some more examples may throw up the need for more changes to the D interface in SWIG.
  • I would like to use stream output from objects, which I have not yet attempted.
  • SWIG has moved on. This work has used version 1.3.19 and it is up to version 1.3.21.

/Examples    

/Messages    

mainly about wxWidgets

Discussion    

I think that for wrapping C this is not needed, as interfaces can be declared directly. I hope it will be helpful in allowing the interfacing of C++ classes, so making things available in D which would otherwise have to be rewritten.

Uploads    

There still needs to be sorted out a way for me to make available my modifications to Andy Friesen's distribution. In the meantime I have uploaded a file swigdmd.zip to the upload page of this wiki. This contains the three files which I have modified from Andy Friesen's distribution. They need to be put into the correct directories, replacing files of the same name.

  • dmd.cxx Source/Modules
  • dmd.swg Lib/dmd
  • dmdhead.swg Lib/dmd
After that, SWIG must be recompiled and installed.

Note: I have only used this under Linux and Cygwin.

The file is available for download by clicking on this link: Upload:duser/swigdmd.zip

I will also add code for the examples, which can be cut and pasted from the wiki.

End    

This completes the examples I have at the moment. I expect to do some more.

Read this - important update    

August 2004 Andy Friesen is working on an improved version. When he has released a new version I will update the examples to work with the new version. In the meantime, these examples only work with the old version plus my modified files.

JohnFletcher

New release    

This is an almost complete rewrite of the previous D backend. Where the previous version was based on the pre-existing C# backend, this one is written from scratch.

You can get it from here: Upload:duser/swig-d-1-Aug-2004.zip

(posted here and not on my HomePage due to maintenance on that system)

This is basically a partial copy of the official SWIG 1.3.21 source distribution. Examples for non-D languages, and a few other things were left out. (if you really want those, you can go to http://www.swig.org and get them from the official maintainers)

Windows binary is included. To build on *nix, all you should really need to do is move the new source trees into the official source package and adjust the autotools scripts to incorporate the extra d.cxx file. (also, don't forget to overwrite or merge Modules/swigmain.cxx, as it was changed a little to add the extra compiler switch)

This is still pretty rough, and I'm sure it needs a lot of work, but it produces flawless output for the "class" example, so it's a fair start, I think.

 -- AndyFriesen

Dsource Project    

Andy also set up a project at dsource, but even that hasn't been active recently.


FolderProjects


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 7, 2012 20:26 (diff))