• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

DocKimbel
24-Aug-2012
[1376]
Pekr: it's easier than you think: just open https://github.com/dockimbel/Red
and click on the "Clone in Windows" button ;)
Pekr
24-Aug-2012
[1377x2]
Well, I am ok with tortoise, I just somehow can't easily swith the 
branches, it can't see them ... one option can see dyn-lib, other 
is still seeing a float branch, etc ...
Will try that. I though I will have to do something on the github 
page. I thought it is "watch" which is needed, but it was not it. 
Clone in windows - what a name ;-)
DocKimbel
24-Aug-2012
[1379x2]
ToirtoiseGit context menu->Switch/Checkout, then choose your branch 
(can be local branch or remote/origin/* or remote/dockimbel/* not 
sure) or add new ones with "..." button on the right side->click 
on remotes->click on origin->select your branch.
So it's not a msvcrt issue it seems.
Kaj
24-Aug-2012
[1381x4]
With the latest series of fixes, I've finally been able to move the 
SQLite binding into a CONTEXT
This has led to a huge shift in the naming of words. If you had written 
anything on this binding, you need to update your programs
Also, because it needs the latest non-released Red/System, I have 
put the binding changes in a separate developing branch:
http://red.esperconsultancy.nl/Red-SQLite
DocKimbel
24-Aug-2012
[1385]
Pekr and Rebolek: could you try to use ProcessMonitor (PM) to see 
if we can get a clue about what is blocking the DLL loading from 
R2?


1) Download it from: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
2) Run it

3) Open a REBOL console and CD to the folder where the DLL is located

4) In PM, drag'n drop the "target" icon to the REBOL console window
5) Type in console: lib: load/library %temp.dll

6) Scroll down in the PM window to look for rebol.exe process entries, 
look for failure reports in Result and Detail columns...
Pekr
24-Aug-2012
[1386]
I know sysinternals tools for quite some time. Just checked, no failure 
reports ....
DocKimbel
25-Aug-2012
[1387x2]
Pekr & Rebolek: can you give it a new try with latest commit (it 
adds relocation support to DLLs).
If it still doesn't work, we'll have to get your hands dirty by diving 
in Windows guts using WinDbg. ;-)
Pekr
25-Aug-2012
[1389x2]
ok, going to test it ....
what is now latest temp.reds source? I got:

Compiling tests/temp.reds ...
Script: "Red/System IA-32 code emitter" (none)
*** Compilation Error: missing argument
*** in file: %runtime/win32.reds
*** in function: ***-dll-entry-point
*** at line: 204
*** near: [hinstDLL]
DocKimbel
25-Aug-2012
[1391x2]
hmm...let me see...
Red/System []

on-load: func [a [integer!]][
	print-line "on-load executed"
]

on-unload: func [a [integer!]][
	print-line "on-unload executed"
]

i: 56
foo: func [a [integer!] return: [integer!]][a + 1]

#export [foo i]
Pekr
25-Aug-2012
[1393x2]
>> exists? %temp.dll
== true
>> lib: load/library %temp.dll
>>
No need to become dirty with WinDbg :-)
DocKimbel
25-Aug-2012
[1395]
Try now:

foo: make routine! [a [integer!] return: [integer!]] lib "foo"
foo 123
Pekr
25-Aug-2012
[1396]
>> foo: make routine! [a [integer!] return: [integer!]] lib "foo"
>> foo 123
== 124
DocKimbel
25-Aug-2012
[1397]
Good! :-)
Pekr
25-Aug-2012
[1398x2]
Yes :-)
So what was the difference? Rellocation support?
DocKimbel
25-Aug-2012
[1400]
It seems some systems are forcing relocation on loading DLLs (even 
when no conflict) while others not.
Pekr
25-Aug-2012
[1401x2]
So we have finally improved DLL support for R2, right? :-)
I mean - now we can make wrapper libs, coding almost in REBOL (syntax), 
no need to become dirty with C, and hence get more libraries to work 
with R2, via a wrapper libraries written in Red/System?
DocKimbel
25-Aug-2012
[1403x2]
It might also be caused by real conflicts from DLLs loaded by REBOL...only 
WinDbg could tell us by looking at the base address of all loaded 
DLLs.
Pekr: yep. :-)
sqlab
25-Aug-2012
[1405]
I can confirm, that it works now
DocKimbel
25-Aug-2012
[1406]
Great!
Pekr
25-Aug-2012
[1407]
Well, if someone would create a plug-in wrapper, we could use the 
aproach for R3 too ...
Robert
25-Aug-2012
[1408]
Doc, can you statically link other C libs and use the functions from 
Red?
DocKimbel
25-Aug-2012
[1409]
Not yet Robert, but that's on the roadmap.
Robert
25-Aug-2012
[1410x2]
Ok, that would be very cool.
Easly creating self-contained DLLs with a R2 / R3 interface would 
be a major time-saver.
DocKimbel
25-Aug-2012
[1412]
can you statically link other C libs...

 you mean link static libraries with Red/System executable, right?
Robert
25-Aug-2012
[1413]
yes, to get one binary.
DocKimbel
25-Aug-2012
[1414x4]
Because for statically linking to dynamic libraries, that's already 
possible.
For static libs linking, if someone could contribute by providing 
a .lib and .a file reader/parser, that would help get that feature 
implemented sooner.
(.lib and .a reader coded in R2)
So, next steps (next week), add PIC support to backends and implement 
shared lib support in Mach-o and ELF emitters.
Pekr
25-Aug-2012
[1418x2]
that's not a microcontroller, right? :-)
OK, position independent code, got it via Wikipedia ...
DocKimbel
25-Aug-2012
[1420x2]
No, it's Position Independent Code: http://en.wikipedia.org/wiki/Position-independent_code
PIC is mandatory in UNIX shared libs.
Pekr
25-Aug-2012
[1422]
so so far only Windows DLLs are supported, right?
DocKimbel
25-Aug-2012
[1423x2]
Right.
But that enables already to build a lot of things, like bridges with 
other languages or VMs.
Pekr
25-Aug-2012
[1425]
yes, generally we are now able to write low level binding using rebol 
like syntax, generate libraries for environments like Delphi, etc., 
which e.g. my friend still uses :-)