World: r3wp
[!REBOL3 Extensions] REBOL 3 Extensions discussions
older newer | first last |
Andreas 13-Feb-2011 [2372x2] | At least there currently is no set of macros to work with "standalone" RXIARGs. |
Only with RXIARGs contained within an RXIFRM (or frame-like array, like in the callback info). | |
Maxim 14-Feb-2011 [2374] | I built my own macros to do exactly this. I proposed them to Carl, he mentioned he'd put them in the official distro... seems like I'll have to put them in git hub myself :-) |
Pekr 14-Feb-2011 [2375] | Good aproach, Max. Now If Carl mistakenly uploads r3 core DLL, we might get in beta after all :-) |
GiuseppeC 14-Feb-2011 [2376] | Just a question: with the extension model complete is it possible to interface to .NET ? |
BrianH 14-Feb-2011 [2377x3] | The answer to that question is as yet unknown. Noone has tried it yet. Do you mean calling into the .NET APIs from native code, or calling into native code from .NET? |
If the latter, this question is better suited for the !REBOL3 Host Kit group. | |
Maxim, if you want those macros included in alpha 111, today would be good. | |
GiuseppeC 14-Feb-2011 [2380] | Calling .NET API from native code. |
BrianH 14-Feb-2011 [2381x2] | I think that there are ways to call .NET APIs from C/C++ using COM interop and other methods. MSDN should have the details. |
It would be useful to have a general .NET wrapper extension that uses Reflection, ActiveX or something to call arbitrary .NET code. | |
Kaj 14-Feb-2011 [2383x2] | http://msdn.microsoft.com/en-us/library/aa446536.aspx |
http://en.wikipedia.org/wiki/Platform_Invocation_Services | |
BrianH 14-Feb-2011 [2385x2] | Those are both for calling native code from .NET code. Guiseppe was requesting the opposite, calling .NET from native. |
Exposing .NET Framework Components to COM: http://msdn.microsoft.com/en-us/library/zsfww439.aspx | |
Robert 15-Feb-2011 [2387] | You can use .NET based DLLs as if there are normal DLLs. |
BrianH 15-Feb-2011 [2388] | How does the .NET runtime get called to run the functions in the DLL? |
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. | |
older newer | first last |