World: r3wp
[!REBOL3 Extensions] REBOL 3 Extensions discussions
older newer | first last |
Kaj 15-Feb-2011 [2389] | Must be a function of the system's loader |
Maxim 16-Feb-2011 [2390x2] | afaik, .net is a dll too. so its probably just loading the .net libs. in fact, looking at some stuff related to C# and p/invoke I realized that the rebol .dll and .net stuff are very similar in scope and function :-) |
the difference is that the type system in VM allows them to jit compile stuff more completely than can be done with REBOL's just-in-time evaluation and binding. | |
Robert 16-Feb-2011 [2392] | IIRC as soon as you load a .NET based DLL, this will trigger the startup of the .NET runtime. So, it's hidden. I don't know if a .NET DLL has a dynamic link to the runtime DLL and calls an init code sequence or if this is done inside the Windows loader. |
Kaj 16-Feb-2011 [2393x2] | Pretty much the same concept as REBOL code in R3 extensions, or OCaml bytecode for the interpreter in standard shared libraries |
The only thing you can't do is fully strip such a library, because then the OCaml bytecode is gone | |
Oldes 16-Feb-2011 [2395x2] | What is error: ** Script error: invalid command format (extension function) ? |
hmm... it's possible to use max 7 args for command. | |
Oldes 17-Feb-2011 [2397x3] | What is error: ** Script error: commaned word is not bound to a context |
ech.. just a typo! | |
Is there any other way how to get series index than from RXA_INDEX macro? http://issue.cc/r3/1858 | |
Andreas 17-Feb-2011 [2400x3] | Oldes, no, there isn't. |
And it is quite possible that this may not be doable at all (if the index is not stored in the "REBSER" structure and the REBSER has no back-pointer to the index-containing rebol value). | |
The workaround/solution is simple: don't pass REBSERs to function, but use the RXIARG instead and then access the index via .index and the REBSER via .series. | |
BrianH 17-Feb-2011 [2403] | The command call process does a lot of marshalling to get the values into the native code. You only have limited access to the original values in REBOL memory. |
Oldes 17-Feb-2011 [2404] | ok |
BrianH 17-Feb-2011 [2405] | This is to allow changes to the internal structures to happen without breaking host or extension code, and for security reasons. |
Andreas 17-Feb-2011 [2406x2] | Oldes, I gained this insight the hard way as well :) |
I guess RXA_SERIES is simply too tempting :) | |
Kaj 17-Feb-2011 [2408x3] | The index is simply not part of a series at the implementation level |
What appears to be a series with an index in REBOL is actually a reference with an index. That's exactly what an RXIARG is. What the hostkit level calls a REBSER is the actual series, not a reference, so that doesn't have an index | |
It takes some massaging of one's brain to arrive at that conclusion :-) | |
Andreas 17-Feb-2011 [2411] | I personally think of the RXIARG (which is a neutered REBOL "value") as "the series", and of the REBSER as a subordniate helper structure (holding width/size/left and data). |
Kaj 17-Feb-2011 [2412] | Yes, at first REBSER seems an incorrect name, but the reality is that RXIARG can be though of as a "REBREF" |
BrianH 17-Feb-2011 [2413] | The index is part of the reference for series, not part of the series itself. |
Kaj 17-Feb-2011 [2414] | That's what I'm saying |
Robert 20-Feb-2011 [2415] | Has anyone done some code using the RL_words_of_object, RL_Get_Field, RL_Set_Field for extensions? I would like to take a look at the code how to best use this stuff. And, is it faster to seperate words & values on the C-side or to call an extension function just with two blocks: words, values? |
ChristianE 20-Feb-2011 [2416] | Not in conjunction with RL_Words_Of_Object, but RL_MAP_WORD, e.g.: type = RL_GET_FIELD(database, RL_MAP_WORD("connection"), &value); ... value.addr = henv; RL_SET_FIELD(database, RL_MAP_WORD("environment"), value, RXT_HANDLE); |
Robert 6-Mar-2011 [2417x2] | Has anyone a simple callback example? |
For callbacks to set the callback function, your C code must have a pointer to the object where it resides (an object you made or some other system context) and the name of the function, as a word id. Those need to be set in the CBI structure: cbi->obj = obj; cbi->word = word; The word ID can be retrieved with RL_MAP_WORD. And a self created context in the same way. But how do I rerieve the ID of the global context (do we still have such a thing?)? | |
BrianH 6-Mar-2011 [2419x3] | You need to pass in a reference to the extension. There is no overarching global context, though there are a few centrally referenced contexts. |
You need to pass in a reference to the extension. -> You need to pass to the extension a reference to the context containing the function. | |
Most words won't be "global" unless they are exported from a module (at which point they will be in the lib context) or system internal (sys context). User script words are in a task-local user context (once we get that working), and module words are in module-local contexts. I'd be shocked if most callback functions weren't at least module-local, or often in hidden inner contexts. | |
Kaj 6-Mar-2011 [2422x3] | There's a callback example in the cURL binding, for progress info |
In the documentation I'm simply using SELF, which would be the user context | |
There are no context IDs and there's no need for RL_MAP_WORD. RXA_WORD handles that | |
Robert 6-Mar-2011 [2425x2] | cbi->obj is of type REBSER* so this suggest to pass in a series. A string with the name of the context? Brian, how does a "reference to the context containing the function" look for this: rebol [] myfunct: does [] What do I pass to the extension here? |
cbi->word would be RXA_WORD of myfunct. But what is cbi->obj? | |
Kaj 6-Mar-2011 [2427] | Just an object. Please refer to the cURL source and documentation |
Robert 6-Mar-2011 [2428] | I only have the source, where is the doc? |
Kaj 6-Mar-2011 [2429] | http://rebol.esperconsultancy.nl |
Robert 12-Mar-2011 [2430x5] | I have a problem with a callback providing a string. |
// call R3 callback RXA_COUNT(cbi) = 1; /* RXA_TYPE(cbi, 1) = RXT_INTEGER; RXA_INT64(cbi, 1) = 123; */ RXA_TYPE(cbi, 1) = RXT_STRING; RXA_SERIES(cbi,1) = RL_Make_String(message);; RXA_INDEX(cbi,1) = 0; int cb_error = RL_CALLBACK(cbi); | |
The RXT_INTEGER part works. But when using a RXT_STRING, R3 crashes. | |
Any idea what this could be? cbi = RXICBI structure. | |
The callback from the C side comes our from a multithreaded DLL. Maybe this is a problem. | |
Pavel 12-Mar-2011 [2435] | Is hostkit A111 released or there are no changes compare to A110? |
Robert 12-Mar-2011 [2436] | Our A111 version is released. |
Kaj 12-Mar-2011 [2437x2] | Is it possible for the callback to be executed simultaneously by multiple threads? Then your allocated REBOL string can be recycled if it has not reached the status of a reference in REBOL yet |
It's also possible that the interpreter can't deal with multiple threads at all yet, but only Carl knows | |
older newer | first last |