POV-Ray : Newsgroups : povray.general : Patch to allow native functions in DLLs? : Re: Patch to allow native functions in DLLs? Server Time
10 Jun 2024 22:24:11 EDT (-0400)
  Re: Patch to allow native functions in DLLs?  
From: David Given
Date: 27 Sep 2015 16:01:02
Message: <56084afe$1@news.povray.org>
On 27/09/15 18:25, Chris Cason wrote:
[...]
> That aside, it's one thing to load a native function from an external
> DLL but another thing entirely to hook it into the rendering chain in
> a coherent manner: there would need to be some sort of specification
> (either in script, or built into the DLL) that defines how/where each
> entry point within it gets hooked in. This isn't an issue for code you
> insert directly into the source, of course.

Yes, this is the tricky bit. Looking at the Povray VM I see that scalar
functions and vector functions go through different pathways. It looks
like my easiest option is to add an OPCODE_DLL which behaves like a
vector function trap and takes the pointer to the native function in the
FunctionCode's private_data. Then add the code in
parser_functions_utilities.cpp to compile it.

This way I could do:

#declare fnord = function { dll("libfnord.so", "fnord") }

...to declare an external function.

-- 
┌─── dg@cowlark.com ─────
http://www.cowlark.com ─────
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.