Exposing a new function in QLAddinCpp

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

Exposing a new function in QLAddinCpp

Lapin
All,

I have finally manage to compile a new C++ example with QLAddinCpp. I will post the update as soon as I can.
In the meantime, I want to expose new functions (that are already available in XL but not in C++) to play around.

For example, I want to expose ohObjectClassName.
To do so, I have changed the xml file (objects.xml in ohgensrc/functions) as below:

    <Procedure name='ohObjectClassName'>   
      <description>get the object class name</description>
      <alias>ObjectHandler::Repository::instance().className</alias>
      <SupportedPlatforms>
        <SupportedPlatform name='Excel'/>
        <SupportedPlatform name='Cpp'/>
      </SupportedPlatforms>
      <ParameterList>
        <Parameters>
          <Parameter name='ObjectID'>
            <type>string</type>
            <tensorRank>vector</tensorRank>
            <description>Object ID name.</description>
          </Parameter>
        </Parameters>
      </ParameterList>
      <ReturnValue>
        <type>string</type>
        <tensorRank>vector</tensorRank>
      </ReturnValue>
    </Procedure>

The challenge is as below. In AddinCpp, the file valueobjects.hpp is not picking up the changes. While it occurs very easily with the XL addins, the Cpp addins seems to be somewhat broken. My guess is gensrc does not rebuild the valueobjects.hpp/cpp files but I have no clue where to fix it.

If someone have faced the same issue, I would be very gratefull.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Exposing a new function in QLAddinCpp

Lapin
I have narrowed down the issue.

In fact everything seems to work fine when you want to expose a QL function through qlgensrc.
It is a different topic when you want to expose a function from the objecthandler through ohgensrc.

My guess is because the files in rules, addins, stubs... for the C++ have not been updated.
I have tried to have a look to see what is missing but if someone could give a direction, that would be great.

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Exposing a new function in QLAddinCpp

Eric Ehlers-2
Hello,

On 2012-12-10 19:32, Lapin wrote:

> I have narrowed down the issue.
>
> In fact everything seems to work fine when you want to expose a QL
> function
> through *qlgensrc*.
> It is a different topic when you want to expose a function from the
> objecthandler through *ohgensrc*.
>
> My guess is because the files in rules, addins, stubs... for the C++
> have
> not been updated.
> I have tried to have a look to see what is missing but if someone
> could give
> a direction, that would be great.

I beleive the autogeneration of the OH functions should be working.  
For example, if you look in file...

     ObjectHandler/gensrc/metadata/functions/logging.xml

...under function ohLogSetFile you find <SupportedPlatform
name='Cpp'/>.  And if you look in file...

     QuantLibAddin/Clients/Cpp/qlademo.cpp

...you see that function ohLogSetFile() is called successfully.

So it should just be a question of copying what's there.  After editing
the XML file you need to rebuild.  If using Visual C++ under Windows
then you would rebuild the ohgensrc project.  If using automake under
linux you would invoke make in directory ObjectHandler/gensrc.

Regards,
Eric

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users