QuantlibAddin - C addin missing files and usage with ctypes in Python

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

QuantlibAddin - C addin missing files and usage with ctypes in Python

Laughing Man-3
Hi,

I would like to develop a Python interface for Quantlib using "ctypes". I understand there are already excellent Python interfaces for Quantlib (SWIG and PyQL) but they are somewhat tied to the same compiler choice as for the Python distribution.
On the other hand ctypes is perhaps a more primitive way of interfacing Python but it doesn't have the limitation above.

I am trying to build the pure "C" interface of the QuantlibAddin package, but it looks like the corresponding project file (AddinC_vc8.vcproj) refers to some non-existing source files (at least not in the same path where it expects to find them).

This is a bit frustrating also because the Excel interface (QuantlibXL) is extremely well developed and documented and I expect the "C" interface to be the same thing in practice (with the only addition of the Excel4 callback functions which can only be called by a running instance of Excel, not from Python).

Is there a quick way of generating the "C" interface for the QuantlibAddin in pretty much the same way as for QuantlibXL, getting -in other words- a DLL with the same functions but no Excel callbacks?
Can someone please point me in the right direction?

Many thanks,

LM



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantlibAddin - C addin missing files and usage with ctypes in Python

Eric Ehlers-3
Hello,

I am sorry to say that the C addin is obsolete.  The last time it was
maintained was many years ago, and the design of QuantLibAddin has
changed since then.  So if you wanted to get it working now you would
need to re-implement it from scratch.  Any files that remain from the
old C addin are probably not useful and should maybe be deleted.

Sorry I can't be more helpful.

Kind Regards,
Eric

On Fri, 30 Jan 2015 15:05:21 +0000
Laughing Man <[hidden email]> wrote:

> Hi,
>
> I would like to develop a Python interface for Quantlib using
> "ctypes". I understand there are already excellent Python interfaces
> for Quantlib (SWIG and PyQL) but they are somewhat tied to the same
> compiler choice as for the Python distribution.
> On the other hand ctypes is perhaps a more primitive way of
> interfacing Python but it doesn't have the limitation above.
>
> I am trying to build the pure "C" interface of the QuantlibAddin
> package, but it looks like the corresponding project file
> (AddinC_vc8.vcproj) refers to some non-existing source files (at
> least not in the same path where it expects to find them).
>
> This is a bit frustrating also because the Excel interface
> (QuantlibXL) is extremely well developed and documented and I expect
> the "C" interface to be the same thing in practice (with the only
> addition of the Excel4 callback functions which can only be called by
> a running instance of Excel, not from Python).
>
> Is there a quick way of generating the "C" interface for the
> QuantlibAddin in pretty much the same way as for QuantlibXL, getting
> -in other words- a DLL with the same functions but no Excel callbacks?
> Can someone please point me in the right direction?
>
> Many thanks,
>
> LM
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantlibAddin - C addin missing files and usage with ctypes in Python

Laughing Man-3

Hello Eric,

many thanks for your reply, I was afraid I was doing something wrong but your email clarifies it.
I would like to get it working anyway (and possibly contribute it to the Quantlib repository if I can manage to fix it), but I don't know exactly where to start.

My understanding is that the QuantlibAddin code is autogenerated by gensrc, but I don't know exactly how it works and couldn't find enough documentation for it (at least when applied to an interface different from Excel).
What could it be a good starting point to understand how it works and generate a pure "C" interface (which I can then use in conjunction with ctypes for usage in Python).

Many thanks,

LM



2015-02-02 8:26 GMT+00:00 Eric Ehlers <[hidden email]>:
Hello,

I am sorry to say that the C addin is obsolete.  The last time it was
maintained was many years ago, and the design of QuantLibAddin has
changed since then.  So if you wanted to get it working now you would
need to re-implement it from scratch.  Any files that remain from the
old C addin are probably not useful and should maybe be deleted.

Sorry I can't be more helpful.

Kind Regards,
Eric

On Fri, 30 Jan 2015 15:05:21 +0000
Laughing Man <[hidden email]> wrote:

> Hi,
>
> I would like to develop a Python interface for Quantlib using
> "ctypes". I understand there are already excellent Python interfaces
> for Quantlib (SWIG and PyQL) but they are somewhat tied to the same
> compiler choice as for the Python distribution.
> On the other hand ctypes is perhaps a more primitive way of
> interfacing Python but it doesn't have the limitation above.
>
> I am trying to build the pure "C" interface of the QuantlibAddin
> package, but it looks like the corresponding project file
> (AddinC_vc8.vcproj) refers to some non-existing source files (at
> least not in the same path where it expects to find them).
>
> This is a bit frustrating also because the Excel interface
> (QuantlibXL) is extremely well developed and documented and I expect
> the "C" interface to be the same thing in practice (with the only
> addition of the Excel4 callback functions which can only be called by
> a running instance of Excel, not from Python).
>
> Is there a quick way of generating the "C" interface for the
> QuantlibAddin in pretty much the same way as for QuantlibXL, getting
> -in other words- a DLL with the same functions but no Excel callbacks?
> Can someone please point me in the right direction?
>
> Many thanks,
>
> LM
>


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantlibAddin - C addin missing files and usage with ctypes in Python

Eric Ehlers-3
Hello,

Your best bet would be to:

1) Get the "full" (Excel) build running:

    http://quantlib.org/quantlibaddin/build_qlxl.html

2) Get the C++ build running:

    http://quantlib.org/quantlibaddin/build_cpp.html

And then implement the C addin by reverse engineering the Excel and C++
addins.  That might sound daunting but several people have succeeded at
that already.  A Guile addin was created once with no input from me.

Those builds use a Python script called gensrc to autogenerate addin
source code.  I have this idea of replacing gensrc with a SWIG module
called Reposit.  I implemented a prototype which comprises C++ and
Excel addins to price an equity swap.  Some day the Reposit project
might replace gensrc.  So if you are feeling lucky and brave you might
try implementing your C addin in Reposit instead of gensrc.  Everything
you need to know about the Reposit project can be found here:

    http://quantlib.org/reposit/index.html

Bon courage.
Eric

On Mon, 2 Feb 2015 10:54:28 +0000
Laughing Man <[hidden email]> wrote:

> Hello Eric,
>
> many thanks for your reply, I was afraid I was doing something wrong
> but your email clarifies it.
> I would like to get it working anyway (and possibly contribute it to
> the Quantlib repository if I can manage to fix it), but I don't know
> exactly where to start.
>
> My understanding is that the QuantlibAddin code is autogenerated by
> gensrc, but I don't know exactly how it works and couldn't find enough
> documentation for it (at least when applied to an interface different
> from Excel).
> What could it be a good starting point to understand how it works and
> generate a pure "C" interface (which I can then use in conjunction
> with ctypes for usage in Python).
>
> Many thanks,
>
> LM
>
>
>
> 2015-02-02 8:26 GMT+00:00 Eric Ehlers <[hidden email]>:
>
> > Hello,
> >
> > I am sorry to say that the C addin is obsolete.  The last time it
> > was maintained was many years ago, and the design of QuantLibAddin
> > has changed since then.  So if you wanted to get it working now you
> > would need to re-implement it from scratch.  Any files that remain
> > from the old C addin are probably not useful and should maybe be
> > deleted.
> >
> > Sorry I can't be more helpful.
> >
> > Kind Regards,
> > Eric
> >
> > On Fri, 30 Jan 2015 15:05:21 +0000
> > Laughing Man <[hidden email]> wrote:
> >
> > > Hi,
> > >
> > > I would like to develop a Python interface for Quantlib using
> > > "ctypes". I understand there are already excellent Python
> > > interfaces for Quantlib (SWIG and PyQL) but they are somewhat
> > > tied to the same compiler choice as for the Python distribution.
> > > On the other hand ctypes is perhaps a more primitive way of
> > > interfacing Python but it doesn't have the limitation above.
> > >
> > > I am trying to build the pure "C" interface of the QuantlibAddin
> > > package, but it looks like the corresponding project file
> > > (AddinC_vc8.vcproj) refers to some non-existing source files (at
> > > least not in the same path where it expects to find them).
> > >
> > > This is a bit frustrating also because the Excel interface
> > > (QuantlibXL) is extremely well developed and documented and I
> > > expect the "C" interface to be the same thing in practice (with
> > > the only addition of the Excel4 callback functions which can only
> > > be called by a running instance of Excel, not from Python).
> > >
> > > Is there a quick way of generating the "C" interface for the
> > > QuantlibAddin in pretty much the same way as for QuantlibXL,
> > > getting -in other words- a DLL with the same functions but no
> > > Excel callbacks? Can someone please point me in the right
> > > direction?
> > >
> > > Many thanks,
> > >
> > > LM
> > >
> >
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantlibAddin - C addin missing files and usage with ctypes in Python

Laughing Man-3
Hello Eric,

thanks for the information. I'll try and do that and see if I manage to get something working for a C addin. I have some familiarity with Python but none at all with SWIG, so am not too sure the latter would be a viable approach for me, but I'll take a look.

Merci bien

LM



2015-02-03 9:44 GMT+00:00 Eric Ehlers <[hidden email]>:
Hello,

Your best bet would be to:

1) Get the "full" (Excel) build running:

    http://quantlib.org/quantlibaddin/build_qlxl.html

2) Get the C++ build running:

    http://quantlib.org/quantlibaddin/build_cpp.html

And then implement the C addin by reverse engineering the Excel and C++
addins.  That might sound daunting but several people have succeeded at
that already.  A Guile addin was created once with no input from me.

Those builds use a Python script called gensrc to autogenerate addin
source code.  I have this idea of replacing gensrc with a SWIG module
called Reposit.  I implemented a prototype which comprises C++ and
Excel addins to price an equity swap.  Some day the Reposit project
might replace gensrc.  So if you are feeling lucky and brave you might
try implementing your C addin in Reposit instead of gensrc.  Everything
you need to know about the Reposit project can be found here:

    http://quantlib.org/reposit/index.html

Bon courage.
Eric

On Mon, 2 Feb 2015 10:54:28 +0000
Laughing Man <[hidden email]> wrote:

> Hello Eric,
>
> many thanks for your reply, I was afraid I was doing something wrong
> but your email clarifies it.
> I would like to get it working anyway (and possibly contribute it to
> the Quantlib repository if I can manage to fix it), but I don't know
> exactly where to start.
>
> My understanding is that the QuantlibAddin code is autogenerated by
> gensrc, but I don't know exactly how it works and couldn't find enough
> documentation for it (at least when applied to an interface different
> from Excel).
> What could it be a good starting point to understand how it works and
> generate a pure "C" interface (which I can then use in conjunction
> with ctypes for usage in Python).
>
> Many thanks,
>
> LM
>
>
>
> 2015-02-02 8:26 GMT+00:00 Eric Ehlers <[hidden email]>:
>
> > Hello,
> >
> > I am sorry to say that the C addin is obsolete.  The last time it
> > was maintained was many years ago, and the design of QuantLibAddin
> > has changed since then.  So if you wanted to get it working now you
> > would need to re-implement it from scratch.  Any files that remain
> > from the old C addin are probably not useful and should maybe be
> > deleted.
> >
> > Sorry I can't be more helpful.
> >
> > Kind Regards,
> > Eric
> >
> > On Fri, 30 Jan 2015 15:05:21 +0000
> > Laughing Man <[hidden email]> wrote:
> >
> > > Hi,
> > >
> > > I would like to develop a Python interface for Quantlib using
> > > "ctypes". I understand there are already excellent Python
> > > interfaces for Quantlib (SWIG and PyQL) but they are somewhat
> > > tied to the same compiler choice as for the Python distribution.
> > > On the other hand ctypes is perhaps a more primitive way of
> > > interfacing Python but it doesn't have the limitation above.
> > >
> > > I am trying to build the pure "C" interface of the QuantlibAddin
> > > package, but it looks like the corresponding project file
> > > (AddinC_vc8.vcproj) refers to some non-existing source files (at
> > > least not in the same path where it expects to find them).
> > >
> > > This is a bit frustrating also because the Excel interface
> > > (QuantlibXL) is extremely well developed and documented and I
> > > expect the "C" interface to be the same thing in practice (with
> > > the only addition of the Excel4 callback functions which can only
> > > be called by a running instance of Excel, not from Python).
> > >
> > > Is there a quick way of generating the "C" interface for the
> > > QuantlibAddin in pretty much the same way as for QuantlibXL,
> > > getting -in other words- a DLL with the same functions but no
> > > Excel callbacks? Can someone please point me in the right
> > > direction?
> > >
> > > Many thanks,
> > >
> > > LM
> > >
> >
>


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users