1. Ver 4.0 call_back question ?
- Posted by bernie Jun 08, 2009
- 880 views
Using Ver 4.0 how do you do a callback to Euphoria from
a ASSEMBLER.
In version 3.11 you could just call the address of the
Euphoria routine after placing the parameters on the stack.
Every since Euphoria started using STDCALL things have become
more difficult.
What was the purpose of changing to STDCALL please don't tell
me that It was because of windows needing STDCALL's because
that is a myth because Microsoft OS software is smart enough
to automatically detect and adjust for the way it is called.
2. Re: Ver 4.0 call_back question ?
- Posted by mattlewis (admin) Jun 08, 2009
- 865 views
Using Ver 4.0 how do you do a callback to Euphoria from
a ASSEMBLER.
In version 3.11 you could just call the address of the
Euphoria routine after placing the parameters on the stack.
Every since Euphoria started using STDCALL things have become
more difficult.
What was the purpose of changing to STDCALL please don't tell
me that It was because of windows needing STDCALL's because
that is a myth because Microsoft OS software is smart enough
to automatically detect and adjust for the way it is called.
Nothing has changed in this respect AFAIK. Microsoft doesn't do anything with regards to the calling convention. Watcom, however, does. I've never had a problem when I've used the same calling convention between caller and callee.
The only thing that has changed with respect to callbacks is to support DEP. But I don't think this affects the calling convention at all. It basically ensures that the callback code is in memory marked for execution.
Matt
3. Re: Ver 4.0 call_back question ?
- Posted by bernie Jun 08, 2009
- 851 views
Using Ver 4.0 how do you do a callback to Euphoria from
a ASSEMBLER.
In version 3.11 you could just call the address of the
Euphoria routine after placing the parameters on the stack.
Every since Euphoria started using STDCALL things have become
more difficult.
What was the purpose of changing to STDCALL please don't tell
me that It was because of windows needing STDCALL's because
that is a myth because Microsoft OS software is smart enough
to automatically detect and adjust for the way it is called.
Nothing has changed in this respect AFAIK. Microsoft doesn't do anything with regards to the calling convention. Watcom, however, does. I've never had a problem when I've used the same calling convention between caller and callee.
The only thing that has changed with respect to callbacks is to support DEP. But I don't think this affects the calling convention at all. It basically ensures that the callback code is in memory marked for execution.
Matt
What about all the virtual allocate code that you have added ?
If you know how to do a call_back to Euphoria ver 4 from
machine code could you please give me a working example.
Thanks.
4. Re: Ver 4.0 call_back question ?
- Posted by mattlewis (admin) Jun 08, 2009
- 918 views
What about all the virtual allocate code that you have added ?
If you know how to do a call_back to Euphoria ver 4 from
machine code could you please give me a working example.
Take a look at fptr. It is able to call and create callbacks for stdcall, cdecl and thiscall (MSVC). Currently, it uses the 3.1.1 includes, but if you replace them with:
include std/machine.e include std/sequence.e include std/dll.e
It should work with eu v4. I just tested with r2143 on Windows XP. It should work on all euphoria platforms (of course, you can't create a DOS callback). I can't say how it plays with DEP, as I've never tried it. I think there's a new 4.0 allocate_code() or something that it should probably use.
The only other thing I can say is that you need to post some code that you think should work, but doesn't.
Matt
PS: In preview, the closing eucode tag is showing.
5. Re: Ver 4.0 call_back question ?
- Posted by mattlewis (admin) Jun 08, 2009
- 848 views
include std/machine.e include std/sequence.e include std/dll.e
PS: In preview, the closing eucode tag is showing.
...and in the actual post...but not, apparently when quoted.
Matt
6. Re: Ver 4.0 call_back question ?
- Posted by bernie Jun 08, 2009
- 841 views
include std/machine.e include std/sequence.e include std/dll.e
PS: In preview, the closing eucode tag is showing.
...and in the actual post...but not, apparently when quoted.
Matt
Thanks I'll take a look at fptr.
I think you forgot the left '<' on the /eucode tag.
If you view the source on the posted HTML you will see its missing.
7. Re: Ver 4.0 call_back question ?
- Posted by mattlewis (admin) Jun 08, 2009
- 861 views
include std/machine.e include std/sequence.e include std/dll.e
PS: In preview, the closing eucode tag is showing.
...and in the actual post...but not, apparently when quoted.
I think you forgot the left '<' on the /eucode tag.
If you view the source on the posted HTML you will see its missing.
The posted html was the output from creole and the forum. The input definitely had the left bracket. If you hit 'quoted reply' from that message, you'll see the the markup is correct. I'm not able to replicate it now, so I guess there was something special about that message.
Matt
8. Re: Ver 4.0 call_back question ?
- Posted by DerekParnell (admin) Jun 08, 2009
- 864 views
PS: In preview, the closing eucode tag is showing.
The problem is with the ++. I'll look into it.
9. Re: Ver 4.0 call_back question ?
- Posted by bernie Jun 08, 2009
- 867 views
- Last edited Jun 09, 2009
I finally got everything working on WIN98.
SVN1705 works ok and so does SVN2142.
Matt: The problem I had was due to the modified assembler that I am using.
When it generated code for a call it was using the #E8 opcode.
I found out that I had load the Euphoria address into the
EAX and use a register call to force it to use the #FF opcode.
Then it would call the Euphoria routine the normal way.
It looks like your com code should be all right on 4.0
There is one thing that still bothers me about 4.0.
If you mouse click on the interpreter, you can't read the option
or version information.
WIN98 it flashes through a scroll of the screen.
XP just flashes open and closes a blank screen.
The end user is not going no that the options exist.
New users are not even going be able to say what version
they are running when asking questions.
I think this should be fixed before beta is released.
Thanks for everybody's help past and present.