dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Strategy for dealing with C++ virtual functions in a managed


From: Neil Cawse
Subject: Re: [DotGNU]Strategy for dealing with C++ virtual functions in a managed binding.
Date: Sun, 8 Dec 2002 10:01:58 -0500

Polymorphism is handled in SWIG

SWIG Features

Code Generation
===============
SWIG current generates wrapper code for nine different target languages:
Guile
Java
Mzscheme
OCAML
Perl
PHP
Python
Ruby
Tcl
** now adding C#

ANSI C
======
SWIG is capable of wrapping all of ANSI C. Features include:
Handling of all ANSI C datatypes.
Global functions, global variables, and constants.
Structures and unions.
Pointers.
Arrays and multidimensional arrays.
Pointers to functions.
Variable length arguments.
Typedef.

ANSI C++
========
SWIG provides wrapping support for almost all of ANSI C++.
All C++ datatypes.
References.
Pointers to members.
Classes.
Inheritance and multiple inheritance.
Overloaded functions and methods (using dynamic dispatch).
Overloaded operators.
Static members.
Namespaces (including using declarations, aliases, nesting, etc.)
Templates
Member templates
Template specialization and partial specialization.
Smart pointers
Library support for strings, STL vectors, and more.
The only major C++ feature not currently supported by SWIG is the wrapping
of nested classes--a problem we're working on. SWIG also does not allow C++
virtual methods to be implemented in the target language (a subtle feature
that might be useful in certain projects).
C++ users who rely on advanced template programming techniques (e.g.,
template meta-programming) should also be aware that SWIG currently requires
manual instantiation of all template classes. Therefore, if your application
somehow involves the instantiation of 50000 template classes, your mileage
might vary.

Preprocessing
=============
SWIG provides a full C preprocessor with the following features:
Macro expansion.
Automatic wrapping of #define statements as constants (when applicable).
Support for C99 (variadic macro expansion).
Customization features
SWIG provides control over most aspects of wrapper generation. Most of these
customization options are fully integrated into the C++ type system--making
it easy to apply customizations across inheritance hierarchies, template
instantiations, and more. Features include:
Customizated type conversion/marshaling.
Exception handling.
Class/structure extension.
Memory management.
Ambiguity resolution.
Template instantiation.
File import and cross-module linking.
Code inclusion, helper function support.
Extensive diagnostics (error/warning messages).
Extended SWIG macro handling.


----- Original Message -----
From: "Patrick Hartling" <address@hidden>
To: "Neil Cawse" <address@hidden>
Sent: Friday, December 06, 2002 1:02 PM
Subject: Re: [Mono-list] Automatically reusing c++ libraries in c#


> Neil,
> This looks really interesting to me.  Just yesterday, I started down the
> path of wrapping an existing collection of C++ libraries in Managed C++.
>   I've already run into some issues (for example, polymorphism between
> C#, unmanaged C++, etc.) that I need to figure out how to address.
> Perhaps what you are developing could save me a lot of work.
> How do you plan to handle polymorphism?  While I haven't looked at the
> internals, Boost.Python allows a class written in Python to be derived
> from a C++ base class.  .NET allows that, too, but only if you are
> already using a .NET language.  After seeing what you have already
> accomplished, I need to take a look at SWIG and see what features it
> allows in terms of inter-language code reuse.  Maybe your .NET extensions
> will come easily based on what has already been done?
>
>   -Patrick


reply via email to

[Prev in Thread] Current Thread [Next in Thread]