1. question about how to add a machine_func to eu ver. 3.11
- Posted by BRyan Aug 30, 2012
- 1467 views
I have added a machine_func to ver. 3.11 The actual function resides in execute.e and has all the necessary constants in the normal places machine.e, etc. The function returns an ATOM. -- global function foo(sequence a, sequence b) -- runs some code here return my_atom end function -- If I translate the code using ( ec.exe -wat eu.ex ) and run the translated interpreter the machine_func works fine with no problems. -- Then I COMPILE the code after editing be_machine.c and I get this error: ---------------------------------------------------------------- compiling the back-end files... linking all the files... Error! E2028: foo_ is an undefined reference file be_machine.obj(C:\1000\SOURCE\be_machine.c): undefined symbol foo_ ---------------------------------------------------------------- It appears that I am not decorating the function properly. How do I indicate to the compiler that the c code is calling a euphoria function in execute.e ?
2. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by mattlewis (admin) Aug 31, 2012
- 1354 views
compiling the back-end files... linking all the files... Error! E2028: foo_ is an undefined reference file be_machine.obj(C:\1000\SOURCE\be_machine.c): undefined symbol foo_
It appears that I am not decorating the function properly. How do I indicate to the compiler that the c code is calling a euphoria function in execute.e ?
Yes, this is somewhat tricky. Basically, you need to call it as a callback. I think that the easiest way to do this is probably to add another machine function that takes the address of your function as a callback. Then you can store that in a function pointer in be_machine.c, and call the callback when that machine func is invoked.
Matt
3. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by BRyan Aug 31, 2012
- 1351 views
Thanks Matt
Bernie
4. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by BRyan Sep 11, 2012
- 1215 views
Yes, this is somewhat tricky. Basically, you need to call it as a callback. I think that the easiest way to do this is probably to add another machine function that takes the address of your function as a callback. Then you can store that in a function pointer in be_machine.c, and call the callback when that machine func is invoked.
Matt
Matt: I can not use a callback because it will not work in DOS I would like to use this code in be_machine.c : case M_CALL_FOO: return call_func(foo_id, {x}); break; Can you please show me how I can do this in "C" or assembler in be_machine.c I need to accomplish this to be able to build the 3.11 binaries.
5. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by jimcbrown (admin) Sep 11, 2012
- 1208 views
I can not use a callback because it will not work in DOS
I would like to use this code in be_machine.c :
case M_CALL_FOO: return call_func(foo_id, {x}); break;
Can you please show me how I can do this in "C" or assembler in be_machine.c
This already works in 4.0, where we pass routine ids around and call them from the C backend, but it is complicated.
I need to accomplish this to be able to build the 3.11 binaries.
Uh, what? Since when? Huh?
... ... ...
...Why?
6. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by BRyan Sep 11, 2012
- 1196 views
Jim: Because 4.0 has become to complicated, overloaded with features and don't support dos.
I want to build my own less complicated version of 3.11
7. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by jimcbrown (admin) Sep 11, 2012
- 1193 views
Jim: I want to build my own less complicated version of 3.11
You want to make 3.11 less complicated .. by adding a new machine_func() that's implemented via Euphorian routine ids?
Why do you want to add a new machine_func() to 3.11? What are you trying to do with it?
8. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by BRyan Sep 11, 2012
- 1189 views
I mean a version of 3.11 that can use DOS on XP
9. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by jimcbrown (admin) Sep 11, 2012
- 1183 views
I mean a version of 3.11 that can use DOS on XP
1. Why do you need to build this yourself?
2. Why do you need to add a machine_func() to do this?
3. Why do you want to do it by calling an Euphorian routine id from the C based backe end?
10. Re: question about how to add a machine_func to eu ver. 3.11
- Posted by BRyan Sep 11, 2012
- 1174 views
I mean a version of 3.11 that can use DOS on XP
1. Why do you need to build this yourself?
2. Why do you need to add a machine_func() to do this?
3. Why do you want to do it by calling an Euphorian routine id from the C based backe end?
I have all my code working using a translated version of EU.EX .
I now want to build binaries using my source ( using BUILD.BAT ) to create the
the binaries that will then contain my NEW FEATURES.
If I don't do that a user can not translate a program that contains my features.