Re: [info-performer] libpfv: Loading user-defined modules via xml file

Date view Thread view Subject view Author view

From: Paolo Farinelli (paolo++at++sgi.com)
Date: 05/02/2003 13:36:54


Hi Sandeep,

The simplest way for your custom modules to be loaded dynamically
through the pfvModule::load methods (or through xml file configuration)
is to compile each module into a separate library and export a 'C' function
to create new modules.

For example, if your module is called MyModule, you should compile
a library called libMyModule.so, and export a 'C' function called
pfvLoadModule_MyModule.

You may then add references to .pfv files, as shown below:

<viewer>
    <module>
        <class>MyModule</class>
     </module>
</viewer>

libpfv will look for a library called libMyModule.so, will open it with
dlopen, then look for function pfvLoadModule_MyModule and call it
to receive a handle to the newly created pfvModule.

You can also compile more than one module into a single library.
The library will have to export 'C' functions called pfvLoadModule_*
for each module class, and you will have to specify the name of the
library in your xml file, as below:

<viewer>

    <module>
        <class>MyModuleA</class>
        <dso>MyModuleLibrary.so</dso>
     </module>

    <module>
        <class>MyModuleB</class>
        <dso>MyModuleLibrary.so</dso>
     </module>

</viewer>

Please take a look at the source for the various pfvm* modules inside
/usr/share/Performer/src/pguide/libpfv/viewer/modules for some
working examples. Note that a module called myModule is provided
as a sort of template for implementing your own custom modules.

Also take a look at the man pages for pfvModule and pfvViewer
for more info.

Hope this helps.
Let me know if you need further assistance.

Paolo

SSM wrote:

>I'm creating some of my own pfvModule subclasses. For the moment, they'll be
>compiled into the same binary as my executable. What plumbing, declarations,
>etc. do I need to put in place so that I can attach one of these modules to the
>pfvViewer by way of the latter's XML configuration file?
>
>Thanks,
>
>Sandeep
>
>
>__________________________________
>Do you Yahoo!?
>The New Yahoo! Search - Faster. Easier. Bingo.
>http://search.yahoo.com
>
>-----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-----------------------------------------------------------------------
>ITEC 2003 Performer Meeting: Wed 30 April, 1800h, ExCeL Waterfront 15
>-----------------------------------------------------------------------
>
>

-- 
Paolo Farinelli                                           paolo++at++sgi.com
Member of Technical Staff, OpenGL Performer              1-650-933-1808
Silicon Graphics        1600 Amphitheatre Pkwy, Mountain View, CA 94043


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri May 02 2003 - 13:36:58 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.