From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,53a571639ed0bc5a X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Dynamic functions Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <46bb3919$0$19890$edfadb0f@dread11.news.tele.dk> Date: Fri, 10 Aug 2007 09:51:31 +0200 Message-ID: <6sdjo0lxt0xs.1ep1p45e58zk2$.dlg@40tude.net> NNTP-Posting-Date: 10 Aug 2007 09:47:21 CEST NNTP-Posting-Host: 107d7924.newsspool1.arcor-online.net X-Trace: DXC=MT?So9YZ`bB2jYf>V4L0gLic==]BZ:afN4Fo<]lROoRA4nDHegD_]RE[Ec?GG<[_;JDNcfSJ;bb[EFCTGGVUmh?DLK[5LiR>kgB6l_gESi?JbN X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:1386 Date: 2007-08-10T09:47:21+02:00 List-Id: On Fri, 10 Aug 2007 08:54:57 +0200, in comp.lang.ada you wrote: > Poul-Erik Andreasen wrote: > >> How is the best way to make a representation of a function/algorithm >> wich can bee setup at runtime in Ada. > > Is there any reason that you cannot convert the function to Ada, write > it to a file, compile it to a plug-in/DLL/shared library, and then > load the plug-in/DLL/shared library? Yup, this is how MatLab and many other similar languages do, if you really need to *program* (as opposed to draw (:-)) something... > The complication is that it requires an Ada compiler on the running > system, but the benefit is pretty fast execution. ? Execution includes elaboration of the code. In your case elaboration would mean to call the compiler, to link the DLL, to load the DLL. How frequent the given function F will be called per run? If you are not going to design some image rendering/processing system with millions of calls per function, it probably will not pay off. Other potential issues: 1. You will need a lot of free system resources to be able to run the compiler/linker in parallel to your program, free memory and disk space. 2. The response time (from request to execute F to its start) will be awful. 3. You will need to manage files (lots of) and other environmental stuff. Deployment, integration etc might turn difficult. 4. DLL interface does not know Ada. Exporting complex data types and objects of from a dynamically loaded DLL could be difficult. 5. DLL handling stuff is non-portable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de