in reply to Re: catch "use Inline::C" death
in thread catch "use Inline::C" death
I found another way with The-bind()-Function of Inline which works fine for multiple code blocks and recovers from previous bad configuration. Unfortunately there is a caveat mentioned in the documentation, which I did not understand:
Although bind() is a powerful feature, it is not recommended for use i +n Inline based modules. In fact, it won't work at all for installable + modules.
This is how I use bind() with code and configuration:
use Inline; Inline->bind( CUDA => $code, BUILD_NOISY => 1, clean_after_build => 0, warnings => 10, );
And it is happy inside eval or try/catch (Try::Tiny).
I was thinking about this and realised that one can have multiple Inline code blocks. I have tried it and also within eval and try/catch and they work except that if a configuration fails (for my tests) then it sticks with it and does not seem to re-configure. Using bind() as above seems to recover from previous bad compilations.
Inline's preferred way is to specify the code in a BEGIN block and then use Inline => ... which does not allow for inlining code dynamically. bind() does.
PS: I have also asked the author a question here
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: catch "use Inline::C" death - multiple+dynamic code blocks
by NERDVANA (Priest) on Jun 17, 2024 at 23:34 UTC | |
by bliako (Abbot) on Jun 20, 2024 at 18:21 UTC |