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

World: r4wp

[#Red] Red language group

Pekr
23-Aug-2012
[1209]
It is probably not related, but you might try with secure none, but 
I does not seem to be problem of REBOL's security or licence missing 
...
Rebolek
23-Aug-2012
[1210]
secure none doesn't help.
DocKimbel
23-Aug-2012
[1211x5]
Let me test if there's no regression in last commits...
Works fine here. I'm testing with:

Red/System [ ]

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

#export [foo i]
You're sure that you're in `dyn-lib-emitter` branch?
(just in case)
If you still can't make it work, send me a copy of your DLL, I'll 
see what's wrong with it.
Rebolek
23-Aug-2012
[1216x4]
Yes, I'm in dyn-lib-emitter branch, otherwise compiler throws #export 
directive not found (or something like that)
My DLL is almost same as your example ('i is missing and function 
is called 'f1 instead of 'foo but otherwise it exactly same :)
RED/System[
	Title: "RED/System inline compilator test"
]

f1: func [a [integer!] return: [integer!]] [a + 1]
#export [f1]
(FYI: I'm trying to implement your make-native example)
DocKimbel
23-Aug-2012
[1220]
Your code works fine here (REBOL 2.7.6): 

>> lib: load/library %builds/test.dll
>> f1: make routine! [a [integer!] return: [integer!]] lib "f1"
>> f1 123
== 124
Rebolek
23-Aug-2012
[1221]
Hm, I'll try with 2.7.6, I'm using 2.7.8 this may be the problem.
DocKimbel
23-Aug-2012
[1222x2]
Works here from 2.7.8 too. Try from a freshly cloned repo.
Or just send me a copy of your DLL at [nr-:-red-lang-:-org], I should be 
able to quickly see what's wrong.
Rebolek
23-Aug-2012
[1224]
The DLL is here: http://box.lebeda.ws/~rebolek/temp.dll
source is here: http://box.lebeda.ws/~rebolek/temp.reds
But I guess it's just some stupid mistake on my side.
DocKimbel
23-Aug-2012
[1225x4]
Let see that...
Works fine here: 

>> lib: load/library %builds/temp.dll
>> f1: make routine! [a [integer!] return: [integer!]] lib "f1"
>> f1 123
== 124
Are you running it under Windows XP?
(I wonder if it's not an OS compatibility issue)
Rebolek
23-Aug-2012
[1229]
No, W7. I will try this under virtual XP
DocKimbel
23-Aug-2012
[1230x3]
I'm running it under W7 too, should be ok.
Mystery deepens...:-)
Are you preloading other DLL in your REBOL session before loading 
temp.dll?
Rebolek
23-Aug-2012
[1233x2]
Same under WXP (virtual) with both 2.7.6 and 2.7.8 . It's probably 
some bad day :)

>> lib: load/library %temp.dll
** Access Error: Cannot open temp.dll as library
** Near: lib: load/library %temp.dll
No, clear session
DocKimbel
23-Aug-2012
[1235x5]
hmm...
Try with following C executable:  http://static.red-lang.org/tmp/loadlib.exe
(or .zip if you have issue downloading the exe).


Put it in the same folder as temp.dll and run it from DOS shell, 
you should have something like: 

C:\Dev\Red\red-system\builds>loadlib
error: 0
hModule: 268435456				;-- library handler
error: 0
&f1: 10001a85				;-- f1 function address
124						;-- f1(123)
error: 0
If it works, the DLL should be ok and the issue would be with your 
REBOL instances.
This is the source code for loadlib.exe: https://gist.github.com/3435800
Also, if someone else could test loading Rebolek's temp.dll lib, 
that would help.
Rebolek
23-Aug-2012
[1240]
Guess what. That works:

c:\code\Red\red-system\builds>loadlib.exe temp.dll
error: 0
hModule: 268435456
error: 0
&f1: 10001a85
124
error: 0

So it's probably really a bad day here for coding/testing :)
DocKimbel
23-Aug-2012
[1241x2]
:-)
The only cause I can think of is because the DLL produced by Red/System 
are not (yet) relocatable, they can be conflicting with other loaded 
DLLs (but shouldn't happen with a fresh REBOL session), or are triggering 
something in anti-virus or Windows security sub-systems.
Pekr
23-Aug-2012
[1243x2]
One thing - between some versions, there was change in syntax of 
"renturn". One version used the colon, the other did not. Just an 
idea ...
but if the same code works for Doc, problem is elsewhere ...
Rebolek
23-Aug-2012
[1245]
Petr, can you please try loading the DLL I provided, so we're sure 
it's just som eproblem with my setup?
Endo
23-Aug-2012
[1246]
I've successfully loaded the temp.dll, R2 2.7.8 on XP/Pro.
DocKimbel
23-Aug-2012
[1247]
It's strange that it didn''t work for Rebolek even on its WinXP virtual 
image...do you have an antivirus installed there?
Endo
23-Aug-2012
[1248x4]
I have Avast on my PC.
Rebolek: if you have a antivirus, can you disable it and try?
Can it be msvcrt.dll version?
Try to watch what happens when loading the dll using Process Monitor 
and File Monitor from System Internals.
MagnussonC
23-Aug-2012
[1252]
lib: do load/library %temp.dll
** Script Error: MZ€ has no value
** Near: lib: do load/library %temp.dll
Endo
23-Aug-2012
[1253]
You are trying with Rebol/Core I think. it doesn't support library. 
Try with View instead.
MagnussonC
23-Aug-2012
[1254]
Ah..
Endo
23-Aug-2012
[1255]
Rebolek: You are using View, right?
MagnussonC
23-Aug-2012
[1256]
I'll try with view ...
Rebolek
23-Aug-2012
[1257x2]
Endo, Nenad: no antivirus. Yes, I'm using View.
Anyway, if it works for everybody else, it's just probably some problem 
with my setup. I'll investigate it and let you know.