Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] dynamically load csoundlib?

Date2006-09-14 09:40
FromVictor Lazzarini
SubjectRe: [Cs-dev] dynamically load csoundlib?
You can use dlopen and dlsym on the Mac, but there are also MACH-specific
functions to do that as well.

Victor

At 19:41 13/09/2006, you wrote:
>I'm no Mac expert. What you want to do is possible both on Windows with 
>LoadLibrary and GetProcAddr, and on Linux/Unix with dlopen and dlsym. I 
>would _think_ that the latter, or close to it, is possible on OS X.
>
>Anyway, the function pointers will be in the CSOUND struct. If a dlopen'd 
>plugin can call a pointer off the CSOUND struct, which it can, then I 
>think it should work the other way too, that a host could call a pointer 
>off a CSOUND struct from csoundCreate.
>
>Regards,
>Mike
>
>-----Original Message-----
> >From: matt ingalls 
> >Sent: Sep 13, 2006 1:33 PM
> >To: Victor.Lazzarini@nuim.ie, Developer discussions 
> 
> >Subject: Re: [Cs-dev] dynamically load csoundlib?
> >
> >
> >On Sep 12, 2006, at 11:20 AM, Victor Lazzarini wrote:
> >
> >> When you say static, do you actually mean linked against
> >> a dynamic lib? Because static really means the actual
> >> code being statically loaded into the executable.
> >
> >sorry, yes - that's what i meant.
> >
> >> Well, as far as I know CsoundLib is designed to be linked
> >> against, rather than loaded at runtime. But this does not
> >> mean it can't be done. Generally (well you know this
> >> already) bundles are loaded at runtime and dylibs linked
> >> against. But dylibs can be loaded at runtime, plugin
> >> opcodes are dylibs that are used like that.
> >>
> >> I am just wondering whether it will be more of a headache
> >> to do this that it might not be worth it.
> >
> >well i am not suggesting to eliminate how it currently works, i
> >was just wondering if it was possible to do it all at run-time.
> >  how i did with with csound4, was i loaded the the csoundLib, then
> >i  grabbed the API function
> >pointers from the CSOUND struct and call the functions that way.
> >i don't know if this is possible with csound5, or if the function
> >pointers
> >are just for the opcode plugins -- i guess i should just look at the
> >code,
> >huh??
> >
> >another way around this is to try to have CsoundLib.framework inside my
> >application bundle ( although i think this might come close to violating
> >the license).   or perhaps the most simplest way is distribute the
> >csoundlib
> >and supportlibs with my installer.
> >
> >thanks,
> >m
> >
> >>
> >> Victor
> >>>
> >>> does any csound front end load the csoundlib dynamically?
> >>> and how it would this work -- do you need to make calls to
> >>> find pointers to the API functions or ??
> >>>
> >>> i used to do this with csound4, but now with csound5 i
> >>> statically   link to it.
> >>> the downside is that if the csoundLib isn't installed (or
> >>> perhaps   just an incompatible version?)
> >>> my host app will not even launch.  i can live with that,
> >>> but i could   see in the future having
> >>> this or other applications where csound is optional and i
> >>> would want   to use my app
> >>> even when csoundLib is not installed.
> >>>
> >>> thanks,
> >>> m
> >>>
> >>> ----------------------------------------------------------
> >>> --------------- Using Tomcat but need to do more? Need to
> >>> support web services, security? Get stuff done quickly
> >>> with pre-integrated technology to make your job easier
> >>> Download IBM WebSphere Application Server v.1.0.1 based on
> >>> Apache Geronimo
> >>>
> >> http://sel.as-us.falkag.net/sel?
> >> cmd=lnk&kid=120709&bid=263057&dat=121642
> >>> _______________________________________________
> >>> Csound-devel mailing list
> >>> Csound-devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >>
> >> ----------------------------------------------------------------------
> >> ---
> >> Using Tomcat but need to do more? Need to support web services,
> >> security?
> >> Get stuff done quickly with pre-integrated technology to make your
> >> job easier
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >> Geronimo
> >> http://sel.as-us.falkag.net/sel?
> >> cmd=lnk&kid=120709&bid=263057&dat=121642
> >> _______________________________________________
> >> Csound-devel mailing list
> >> Csound-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >>
> >
> >
> >-------------------------------------------------------------------------
> >Using Tomcat but need to do more? Need to support web services, security?
> >Get stuff done quickly with pre-integrated technology to make your job 
> easier
> >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >_______________________________________________
> >Csound-devel mailing list
> >Csound-devel@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-09-14 12:01
FromVictor Lazzarini
SubjectRe: [Cs-dev] dynamically load csoundlib?
Just a thought: isn't this a perversion of the principles of the API?
If you get pointers to stuff in CSOUND*, you are actually bypassing
the public API, and has access to everything. Not saying it is a problem,
since you know what you are doing. But it is a bit naughty :)

Victor

At 09:40 14/09/2006, you wrote:
>You can use dlopen and dlsym on the Mac, but there are also MACH-specific
>functions to do that as well.
>
>Victor
>
>At 19:41 13/09/2006, you wrote:
> >I'm no Mac expert. What you want to do is possible both on Windows with
> >LoadLibrary and GetProcAddr, and on Linux/Unix with dlopen and dlsym. I
> >would _think_ that the latter, or close to it, is possible on OS X.
> >
> >Anyway, the function pointers will be in the CSOUND struct. If a dlopen'd
> >plugin can call a pointer off the CSOUND struct, which it can, then I
> >think it should work the other way too, that a host could call a pointer
> >off a CSOUND struct from csoundCreate.
> >
> >Regards,
> >Mike
> >
> >-----Original Message-----
> > >From: matt ingalls 
> > >Sent: Sep 13, 2006 1:33 PM
> > >To: Victor.Lazzarini@nuim.ie, Developer discussions
> > 
> > >Subject: Re: [Cs-dev] dynamically load csoundlib?
> > >
> > >
> > >On Sep 12, 2006, at 11:20 AM, Victor Lazzarini wrote:
> > >
> > >> When you say static, do you actually mean linked against
> > >> a dynamic lib? Because static really means the actual
> > >> code being statically loaded into the executable.
> > >
> > >sorry, yes - that's what i meant.
> > >
> > >> Well, as far as I know CsoundLib is designed to be linked
> > >> against, rather than loaded at runtime. But this does not
> > >> mean it can't be done. Generally (well you know this
> > >> already) bundles are loaded at runtime and dylibs linked
> > >> against. But dylibs can be loaded at runtime, plugin
> > >> opcodes are dylibs that are used like that.
> > >>
> > >> I am just wondering whether it will be more of a headache
> > >> to do this that it might not be worth it.
> > >
> > >well i am not suggesting to eliminate how it currently works, i
> > >was just wondering if it was possible to do it all at run-time.
> > >  how i did with with csound4, was i loaded the the csoundLib, then
> > >i  grabbed the API function
> > >pointers from the CSOUND struct and call the functions that way.
> > >i don't know if this is possible with csound5, or if the function
> > >pointers
> > >are just for the opcode plugins -- i guess i should just look at the
> > >code,
> > >huh??
> > >
> > >another way around this is to try to have CsoundLib.framework inside my
> > >application bundle ( although i think this might come close to violating
> > >the license).   or perhaps the most simplest way is distribute the
> > >csoundlib
> > >and supportlibs with my installer.
> > >
> > >thanks,
> > >m
> > >
> > >>
> > >> Victor
> > >>>
> > >>> does any csound front end load the csoundlib dynamically?
> > >>> and how it would this work -- do you need to make calls to
> > >>> find pointers to the API functions or ??
> > >>>
> > >>> i used to do this with csound4, but now with csound5 i
> > >>> statically   link to it.
> > >>> the downside is that if the csoundLib isn't installed (or
> > >>> perhaps   just an incompatible version?)
> > >>> my host app will not even launch.  i can live with that,
> > >>> but i could   see in the future having
> > >>> this or other applications where csound is optional and i
> > >>> would want   to use my app
> > >>> even when csoundLib is not installed.
> > >>>
> > >>> thanks,
> > >>> m
> > >>>
> > >>> ----------------------------------------------------------
> > >>> --------------- Using Tomcat but need to do more? Need to
> > >>> support web services, security? Get stuff done quickly
> > >>> with pre-integrated technology to make your job easier
> > >>> Download IBM WebSphere Application Server v.1.0.1 based on
> > >>> Apache Geronimo
> > >>>
> > >> http://sel.as-us.falkag.net/sel?
> > >> cmd=lnk&kid=120709&bid=263057&dat=121642
> > >>> _______________________________________________
> > >>> Csound-devel mailing list
> > >>> Csound-devel@lists.sourceforge.net
> > >>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> > >>
> > >> ----------------------------------------------------------------------
> > >> ---
> > >> Using Tomcat but need to do more? Need to support web services,
> > >> security?
> > >> Get stuff done quickly with pre-integrated technology to make your
> > >> job easier
> > >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > >> Geronimo
> > >> http://sel.as-us.falkag.net/sel?
> > >> cmd=lnk&kid=120709&bid=263057&dat=121642
> > >> _______________________________________________
> > >> Csound-devel mailing list
> > >> Csound-devel@lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/csound-devel
> > >>
> > >
> > >
> > >-------------------------------------------------------------------------
> > >Using Tomcat but need to do more? Need to support web services, security?
> > >Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > >_______________________________________________
> > >Csound-devel mailing list
> > >Csound-devel@lists.sourceforge.net
> > >https://lists.sourceforge.net/lists/listinfo/csound-devel
> >
> >
> >
> >
> >-------------------------------------------------------------------------
> >Using Tomcat but need to do more? Need to support web services, security?
> >Get stuff done quickly with pre-integrated technology to make your job 
> easier
> >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >_______________________________________________
> >Csound-devel mailing list
> >Csound-devel@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>Victor Lazzarini
>Music Technology Laboratory
>Music Department
>National University of Ireland, Maynooth
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net