r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Extensions] REBOL 3 Extensions discussions

BrianH
14-Dec-2010
[1928x2]
I tried all of the possibilities, and that is the policy that grants 
the greatest flexibility and control to the end-developer with the 
least code, and the least surprise. We even tested this with third-party 
developers and code bases. Given the REBOL language, it's the best 
policy.
Strangely enough, the whole point of the lib runtime library is to 
manage overrides. That is why we don't have explicit import by default 
too.
Maxim
15-Dec-2010
[1930]
this is my pet peeve of an automatic export system (in any language). 
 the "user" of a lib isn't the one managing the possible clashes 
and he has no control over it, because the design makes exporting 
things the default behaviour. 


to protect from this, people then have to start prefixing their tools, 
and the readability of source code then is reduced.


currently when I use R3 modules, It feels very much like I'm doing 
#includes in C but I get no warning that I'm potentially introducing 
a nameclash.
BrianH
15-Dec-2010
[1931x3]
Well, in R3 exporting things is not the default behavior: The module 
maker has to explicitly mark something to be exported, and even then 
if there is a name clash the export doesn't happen. Plus, all exported 
words are right there in the module header (even the keyword-exported 
ones) so you can check for conflicts if you like.
So it's more like #include with every define wrapped in an #ifndef 
(is that the word for "if not defined"?).
REBOL doesn't have a "warning" mechanism at all, it just has an error 
mechanism. Warning mechanisms are really awkward at runtime - that 
is why you only see them in compilers or applications with runtime 
logging. And only the latter would apply to us. We have been talking 
about making a binding lint tool for R3 though, and that could easily 
generate such warnings.
Anton
16-Dec-2010
[1934]
(#ifndef, yes)
Kaj
17-Dec-2010
[1935]
Is it safe to have a command without arguments return a value? Is 
there a return slot reserved anyway in the arguments frame?
Maxim
17-Dec-2010
[1936]
the return slot is the first argument in the frame.  AFAIK the argument 
frame is always the same size no matter how many arguments to actually 
supply (0 to 8)
Kaj
17-Dec-2010
[1937]
Ah, OK, safe then. That makes that combination a lot easier
Oldes
18-Dec-2010
[1938x2]
Is there any example how to deal with objects? Especially how to 
create objects on C side.
I've found it.. I must use RL_SET_FIELD macro... but it requires 
to define all posible words.
Andreas
21-Dec-2010
[1940x3]
After importing an extension, I consistently get a REBOL error if 
I allocate any non-trivial amount of memory afterwards:

>> import %./sample.so
>> array 100'000 
== REBOL System Error:
REBOL System Error #1207: assertion failed
Happens for my own extensions on both Win32 A110 and Linux A110. 
Also just tried it with Kaj's cURL extension, same problem.
Anyone else seeing this?
Kaj
21-Dec-2010
[1943]
== REBOL System Error:
REBOL System Error #1207: assertion failed

Program terminated abnormally.
This should never happen.
Please contact www.REBOL.com with details.
Andreas
21-Dec-2010
[1944]
Linux A110?
Kaj
21-Dec-2010
[1945]
Yes
Andreas
21-Dec-2010
[1946]
Thanks, I'll report it as bug.
Kaj
21-Dec-2010
[1947]
Looks noteworthy :-)
Kaj
22-Dec-2010
[1948]
When I go beyond 14 commands, importing segfaults. I thought people 
had made extensions with far more commands?
Oldes
22-Dec-2010
[1949x4]
I don't see none of these these problems with my FMOD extension.
I'm on XP only.
Maybe you do something wrong in your extension.
Just tested your extension attached to CC (sample.c) and I cannot 
repro the assertion as well.
Andreas
22-Dec-2010
[1953x3]
Thanks for testing, Oldes.
Would you mind mailing me your resulting .dll?
And what compiler did you use? GCC or MSVC?
Oldes
22-Dec-2010
[1956]
gcc (GCC) 3.4.5 (mingw-vista special r3)
Andreas
22-Dec-2010
[1957]
Would you mind trying the following:
http://bolka.at/2010/rebol3/tmp/sample.dll
Oldes
22-Dec-2010
[1958]
works
Andreas
22-Dec-2010
[1959]
Ok, so works on XP, fails on Linux and Wine. Will try Win7 later 
on.
Kaj
22-Dec-2010
[1960]
I've tested extensively, and no matter what I do, it segfaults right 
away on init when there are more than 14 commands in the init block. 
That's indeed on Linux
Andreas
22-Dec-2010
[1961x2]
Hm, a trivial extension exporting 20 commands seems to work fine 
for me:
https://gist.github.com/e9192ae7083a2fbf5d78
Both for A110 Linux and A110 Win32+Wine.
Kaj
22-Dec-2010
[1963x3]
Interesting, but that's a very empty example. Can you try with command 
parameters?
I'm exporting them wrapped in a context. That may make a difference
When I split the cURL binding in two contexts, it works, so it seems 
to be some object limit
Andreas
22-Dec-2010
[1966x3]
Very peculiar.
When I export a context wrapping the above 20 cmds, it still works.
export cmds: context [cmd01: command [] cmd02: ...]
Kaj
22-Dec-2010
[1969x2]
Then please give them some more work to do
It also bombs out for me when the fifteenth context slot is such 
an empty command
Andreas
22-Dec-2010
[1971x2]
Makes no difference even if I add 3 parameters to each of them.
Let me try with 10 parameters each.
Kaj
22-Dec-2010
[1973]
It sure is a strange thing :-)
Andreas
22-Dec-2010
[1974x3]
Most peculiar, yes.
Nope, 20 cmds with 10 params each works as well.
Maybe something to do with the length of the init block?
Kaj
22-Dec-2010
[1977]
OK, let me upload the cURL binding source for you