[Top][All Lists]

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

[Savannah-register-public] [task #5638] Submission of C/Invoke

From: Will Weisser
Subject: [Savannah-register-public] [task #5638] Submission of C/Invoke
Date: Sat, 10 Jun 2006 02:54:46 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727)


                 Summary: Submission of C/Invoke
                 Project: Savannah Administration
            Submitted by: kyuzo
            Submitted on: Saturday 06/10/2006 at 02:54
         Should Start On: Saturday 06/10/2006 at 00:00
   Should be Finished on: Tuesday 06/20/2006 at 00:00
                Category: Project Approval
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Percent Complete: 0%
             Open/Closed: Open
                  Effort: 0.00



A new project has been registered at Savannah 
The project account will remain inactive until a site admin approve or
discard the registration.


While this item will be useful to track the registration process, approving
or discarding the registration must be done using the specific "Group
Administration" page, accessible only to site administrators, effectively
logged as site administrators (superuser):


######### REGISTRATION DETAILS ######### 

Full Name:

System Group Name:

  non-GNU software & documentation

  Modified BSD License

  The purpose of this project is to provide a library which can be used by
developers of dynamic programming languages to call C functions at runtime. 
This is a distinct method of making calls from the typical compile-time
static declarations which are typically used.  To the author's knowledge, no
such library providing these facilities currently exists.

Currently in order to bridge a dynamic language (Perl, PHP, Ruby, Python,
etc. etc. etc.) to C, one must author a module in C which imports and links
to the desired low-level libraries at compile time, and then write cumbersome
code to hand-marshal the parameters and return values back and forth between
the the dynamic language and the C library.  This module, being a compiled C
library itself, has several disadvantages when paired with a dynamic
programming environment (hard to write, unportable, etc.).  Frameworks such
as SWIGS remove some of the tedious repetition of hand-writing marshalling
code and learning large and involved glue libraries, but they do not change
the essential nature of writing language bindings: one is compiling and using
a static module in a dynamic language.

The Microsoft .NET framework (and its free equivalents) provide a facility
called P/Invoke which was the inspiration for this project.  To call a native
C library in this system, one informs the language compiler of the C function
one wishes to call using declarative programming constructs.  The language
then uses built-in support to create a bridge to the desired C function and
creates a stub in the dynamic language which transparently calls the C
function when desired.  This project (C/Invoke) provides a facility for
dynamic languages to provide similar features.  With it, a language
implementor can input a description of a C function *at runtime*, and make
calls to said function and receive results.  The C/Invoke library handles
details such as pushing arguments on the stack and retrieving return values
from registers.  Because such code is inherantly platform-specific, the
authors will maintain ports of the code to as many different architectures
and operating systems as possible.  With this functionality in place,
programmers wishing to call C functions from Python can do so by writing
Python, Perl programmers by writing Perl, etc.  This will help all languages
interoperate with each other better and will relieve many portability
headaches since these will be centrally located in C/Invoke. Bindings to
languages can also be implemented as regular extension modules if

C/Invoke is itself implemented in C.  The latest source is always available
via anonymous svn at svn://  A snapshot of the code
as of this writing is available at  At present, the code is mostly
complete, being able to call functions, marshal structures, deal with
callback function pointers etc.  More work needs to be done before the
initial release however, including ports to more platforms (at present only
Linux x86 and Windows x86 have been written), language bindings,
documentation, etc.

Other Software Required:
  This project does not currently have any external dependancies.  When
language bindings are released in the future, then users will need to have
these languages installed in order to take advantage of them; however, there
are no plans to develop bindings for non-free languages, and technically
these languages would then depend on C/Invoke, not the other way around.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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