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

World: r4wp

[#Red] Red language group

DocKimbel
23-Aug-2012
[1236x4]
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
[1257x3]
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.
Sorry for the false alarm :)
MagnussonC
23-Aug-2012
[1260x2]
I don't get any output, just a question if I'm allowing to open a 
port for read/write ...
I'm on Win 7 x64 & rebol-view-278-3-1... Never mind me, I'm just 
fooling around with this.
Pekr
23-Aug-2012
[1262x2]
I am getting the same problem as REBOLEK
what is the source code? UTF8, or Windows32?
DocKimbel
23-Aug-2012
[1264x2]
You mean the C source code I posted, I guess it's a Unicode main() 
from VisualStudio, you can safely replace it with a standard main().
Pekr: does loadlib works for you too?
Pekr
23-Aug-2012
[1266x6]
No, I mean the source code file ... but not sure it matters. E.g. 
for R3, I had difficulcy running some scripts, unless I re-saved 
the source file to UTF8. Some strange chars appeared in the console 
and apps crashed
Loadlib works ...
I might try to compile the library myself. How do I get different 
branch onto my PC?
You need to use the WinDLL target: -t WinDLL
 - where, how? I need simple explanation how to compile the line:

do/args %rsc.r .... what now?
... otherwise it produces the exe for me ...
got it, needs to be enclosed in string along with the script name 
...
DocKimbel
23-Aug-2012
[1272]
do/args %rsc.r "-t WinDLL %temp.reds"
MagnussonC
23-Aug-2012
[1273x2]
I compiled it OK and loadlib works
Maybe it is F-secure that stops the DLL ... not sure it I can stop 
it at work.
DocKimbel
23-Aug-2012
[1275x2]
MagnussonC: thanks for testing.
How do I get different branch onto my PC?

 If you're using TortoiseGit client, just search in the context menu 
 for "Switch/Checkout", then select the `dyn-lib-emitter`branch. If 
 you don't have it, you need to click on "..." button and create a 
 remote to dockimbel/dyn-lib-emitter.
Pekr
23-Aug-2012
[1277]
Well, downloaded zip. I was scared it will sync to the same dir and 
will create a mess :-)
DocKimbel
23-Aug-2012
[1278]
It will sync in the same dir, replacing everything that needs to 
be replaced, no mess here, just Git doing its job! ;-)
Pekr
23-Aug-2012
[1279]
well, and if you want to keep several branches?
Endo
23-Aug-2012
[1280x2]
I've uploaded a file on Altme, DLLFunc, it loads a dll and prints 
the function names. It works with temp.dll, shows "f1" function.
Its Windows only.
DocKimbel
23-Aug-2012
[1282x2]
You need to checkout the branch in a new local folder if you want 
to have several branches of code at the same time (I never had that 
need as switching between them is done in a couple of seconds).
Endo: thanks, tested the downloaded %temp.dll from Rebolek, shows 
"f1".
MagnussonC
23-Aug-2012
[1284]
I think I stopped F-secure, but still no output :(
Pekr
23-Aug-2012
[1285]
Entry Point RAW: 	Invalid or not in CODE section (possible Encrypted 
or Compress Executable)