Re: Calling Install[] from packages
- To: mathgroup at smc.vnet.net
- Subject: [mg39942] Re: Calling Install[] from packages
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 13 Mar 2003 03:00:07 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <b4mnor$im6$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
"Lawrence A. Walker Jr." wrote: > Hi, before you install the link, look in Links[] if the program is already installed. Here is an example my digital image processing tools need a MathLink program dip32.exe, it is somewhere in the $Path, in the DigitalImages/Binaries/$SystemID folder and on all machines it has the name dip32.exe (SGI, Linux, Windows, MacOS X) $mlbinpath = {"DigitalImages", "Binaries", $SystemID}; $mlbinary = "dip32.exe" $diplink=FileNames[$mlbinary, ToFileName[Prepend[$mlbinpath, #]] & /@ $Path] dip::nolink="Can't find \"dip32.exe\". Some functions may not work."; (* if dip32.exe is not in Links[] *) If[!(Or @@ (StringMatchQ[First[#], "*dip32.exe"] & /@ Links[])), (* Than try to Intall[] it *) If[{}===$diplink, (* no dip32 at all *) Message[dip::nolink], (* else install the ML program *) $dipLink=Install[First[$diplink]] ] ] Regards Jens > Hi group: > > Todd Gayley's Mathlink tutorial is very helpful. Mr. Gayley has > explained the advantages and disadvantages of either (1) package code > de-embedded in external (Mathlink'd) programs, or (2) calling external > programs from within the package (*.m). > > I chose the latter in my present project. I have encountered a > situation when package A runs package B via the Need[] command. Package > B then links to the external program C. Since package B is ran > automatically, a user could attempt to run package B again. The context > handling functions appears to work ok in this case. However, a duplicate > link of the external program is setup. In other words, Install[] is ran > again. I desire that package B test to see if a link to the external > program is already set up. If it is then don't install the external > program. > > Does anyone know of a way to handle the situation so that external > programs are linked to as needed? > > Thanks, > Lawrence > > -- > Lawrence A. Walker Jr. > http://www.kingshonor.com