www.digitalmars.com         C & C++   DMDScript  

c++ - Compile small functions by DM C++ Compiler

reply L1f <L1f_member pathlink.com> writes:
I have a small function, likes that:

float my_func(float x)
{
return x*x*x;
}

How I can compile this into machine codes by DM C++ Compiler?
PS: full functions likes main() i can compile.
Mar 20 2006
parent reply Bertel Brander <bertel post4.tele.dk> writes:
L1f wrote:
 I have a small function, likes that:
 
 float my_func(float x)
 {
 return x*x*x;
 }
 
 How I can compile this into machine codes by DM C++ Compiler?
 PS: full functions likes main() i can compile.
I think this should do the trick: dmc -cod -c float.cpp I don't have obj2asm so I can't really test it. -- Absolutely not the best homepage on the net: http://home20.inet.tele.dk/midgaard But it's mine - Bertel
Mar 20 2006
next sibling parent reply L1f <L1f_member pathlink.com> writes:
In article <dvn3nn$q5p$1 digitaldaemon.com>, Bertel Brander says...
L1f wrote:
 I have a small function, likes that:
 
 float my_func(float x)
 {
 return x*x*x;
 }
 
 How I can compile this into machine codes by DM C++ Compiler?
 PS: full functions likes main() i can compile.
I think this should do the trick: dmc -cod -c float.cpp I don't have obj2asm so I can't really test it.
After that operations I get *.obj - file. I dont now that I will do with this file!!! I am stupid??? Describe me please! Symply, I want: I have any code on C++ language: for axample: float my_fync(float x, float y, float z) { return (x*y+z*x)*sin(x); } And I want to get machine code likely this: 00000 d9 44 24 04 fld DWORD PTR _time$[esp-4] 00004 d8 89 08 04 00 00 fmul DWORD PTR [ecx+1032] 0000a d9 99 04 04 00 00 fstp DWORD PTR [ecx+1028] 00010 c2 04 00 ret 4 (Generated by MSVC++) BUT generated by DM C++ Compiler!!! Help me PLEASE!! PS: Sory for my english.
Mar 20 2006
parent reply Bertel Brander <bertel post4.tele.dk> writes:
L1f wrote:
 In article <dvn3nn$q5p$1 digitaldaemon.com>, Bertel Brander says...
 L1f wrote:
 I have a small function, likes that:

 float my_func(float x)
 {
 return x*x*x;
 }

 How I can compile this into machine codes by DM C++ Compiler?
 PS: full functions likes main() i can compile.
I think this should do the trick: dmc -cod -c float.cpp I don't have obj2asm so I can't really test it.
After that operations I get *.obj - file. I dont now that I will do with this file!!! I am stupid??? Describe me please! Symply, I want: I have any code on C++ language: for axample: float my_fync(float x, float y, float z) { return (x*y+z*x)*sin(x); } And I want to get machine code likely this: 00000 d9 44 24 04 fld DWORD PTR _time$[esp-4] 00004 d8 89 08 04 00 00 fmul DWORD PTR [ecx+1032] 0000a d9 99 04 04 00 00 fstp DWORD PTR [ecx+1028] 00010 c2 04 00 ret 4 (Generated by MSVC++) BUT generated by DM C++ Compiler!!!
You wrote that you were able to get the machine code when you have an main, my fix is only to get it without the main. To get the machine code you need obj2asm from the "Extended Utility Package": http://www.digitalmars.com/eup.html
 PS: Sory for my english.
Sorry for mine, my first language is danish. -- Absolutely not the best homepage on the net: http://home20.inet.tele.dk/midgaard But it's mine - Bertel
Mar 20 2006
parent L1f <L1f_member pathlink.com> writes:
In article <dvn7mc$vht$1 digitaldaemon.com>, Bertel Brander says...
...
Thank You for help!
Mar 20 2006
prev sibling next sibling parent L1f <L1f_member pathlink.com> writes:
In article <dvn3nn$q5p$1 digitaldaemon.com>, Bertel Brander says...
L1f wrote:
 I have a small function, likes that:
 
 float my_func(float x)
 {
 return x*x*x;
 }
 
 How I can compile this into machine codes by DM C++ Compiler?
 PS: full functions likes main() i can compile.
I think this should do the trick: dmc -cod -c float.cpp I don't have obj2asm so I can't really test it.
After that operations I get *.obj - file. I dont now that I will do with this file!!! I am stupid??? Describe me please! Symply, I want: I have any code on C++ language: for axample: float my_fync(float x, float y, float z) { return (x*y+z*x)*sin(x); } And I want to get machine code likely this: 00000 d9 44 24 04 fld DWORD PTR _time$[esp-4] 00004 d8 89 08 04 00 00 fmul DWORD PTR [ecx+1032] 0000a d9 99 04 04 00 00 fstp DWORD PTR [ecx+1028] 00010 c2 04 00 ret 4 (Generated by MSVC++) BUT generated by DM C++ Compiler!!! Help me PLEASE!! PS: Sory for my english.
Mar 20 2006
prev sibling parent L1f <L1f_member pathlink.com> writes:
In article <dvn3nn$q5p$1 digitaldaemon.com>, Bertel Brander says...
L1f wrote:
 I have a small function, likes that:
 
 float my_func(float x)
 {
 return x*x*x;
 }
 
 How I can compile this into machine codes by DM C++ Compiler?
 PS: full functions likes main() i can compile.
I think this should do the trick: dmc -cod -c float.cpp I don't have obj2asm so I can't really test it.
After that operations I get *.obj - file. I dont now that I will do with this file!!! I am stupid??? Describe me please! Symply, I want: I have any code on C++ language: for axample: float my_fync(float x, float y, float z) { return (x*y+z*x)*sin(x); } And I want to get machine code likely this: 00000 d9 44 24 04 fld DWORD PTR _time$[esp-4] 00004 d8 89 08 04 00 00 fmul DWORD PTR [ecx+1032] 0000a d9 99 04 04 00 00 fstp DWORD PTR [ecx+1028] 00010 c2 04 00 ret 4 (Generated by MSVC++) BUT generated by DM C++ Compiler!!! Help me PLEASE!! PS: Sory for my english.
Mar 20 2006