Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2005, 14:25
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
As far as I know most of C++ compilers first convert C++ code to C before compiling.
I've used convertors, none of them is 100% reliable. You can use another way to do your job by static linking . First compile your C++ codes using C++ compilers and make .LIB file. Then you can use extern in your C codes to use methods from your compiled C++ code (.lib)

Your C compiler will link the lib file to your final exe and the job is done.

Regards
OMID
Reply With Quote
  #2  
Old 01-17-2005, 15:21
nuemga2000 nuemga2000 is offline
Friend
 
Join Date: Jan 2002
Posts: 59
Rept. Given: 1
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
nuemga2000 Reputation: 2
Hi,
it's not quite clear, what you want to do :
- port the C++ source code to C ...
- use your C++ code from some other C stuff ...

Kerstin
Reply With Quote
  #3  
Old 01-17-2005, 16:53
arkanoid
 
Posts: n/a
Thanks for your answers.
My aim is porting cpp code to asm.
Porting to c is an intermediate step.
I want to optimize the code and make it smaller, run faster and so on.
It would be better if I can convert it directly to asm.
But It looks little bit hard (for me) because of many injected codes by cpp compiler.
I think I need to understand the code first.
That's why I'm porting it to c.
But many features of cpp are hard to port to c.
I just wonder if there are any tips or guidances for doing that.
Reply With Quote
  #4  
Old 01-17-2005, 20:30
Kerlingen
 
Posts: n/a
If you want to port C++ into ASM you should use the Borland C++ compiler. It has an option called "compile via assembly" (commandline switch "-B"). This first translates the CPP file to ASM and then passes it to TASM32.

If you rename TASM32.EXE to something else you will get an error message, but BCC32 won't delete the ASM file so you can take the code you want out of it.
Reply With Quote
  #5  
Old 01-17-2005, 21:25
dmownz
 
Posts: n/a
The original C++ compiler by Bjarne Stroustroup (called cfront) converts c++ to c. You might be able to find it by searching for cfront on the net.
Reply With Quote
  #6  
Old 01-17-2005, 21:28
infern0 infern0 is offline
Friend
 
Join Date: Dec 2004
Posts: 72
Rept. Given: 4
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 0
Thanks Rcvd at 2 Times in 2 Posts
infern0 Reputation: 0
Quote:
Originally Posted by Kerlingen
If you want to port C++ into ASM you should use the Borland C++ compiler.
all compilers has such feature. For borland switch are -B, for ms VC -Fa (generally -F?).
Reply With Quote
  #7  
Old 01-18-2005, 15:52
nuemga2000 nuemga2000 is offline
Friend
 
Join Date: Jan 2002
Posts: 59
Rept. Given: 1
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
nuemga2000 Reputation: 2
Quote:
Originally Posted by arkanoid
Thanks for your answers.
My aim is porting cpp code to asm.
Porting to c is an intermediate step.
I want to optimize the code and make it smaller, run faster and so on.
It would be better if I can convert it directly to asm.
But It looks little bit hard (for me) because of many injected codes by cpp compiler.
I think I need to understand the code first.
That's why I'm porting it to c.
But many features of cpp are hard to port to c.
I just wonder if there are any tips or guidances for doing that.
I don't think, that it really makes sense just to use some compilers asm output.
To get a real benefit, you should try to catch the algorithm(s) used and reimplement them from scratch ...

Kerstin
Reply With Quote
  #8  
Old 01-18-2005, 16:02
arkanoid
 
Posts: n/a
nuemga2000 // That's what I'm talking about. I agree with you.
I'm still trying to understand that code.
Compiler produced asm code is just a reference. Better than nothing.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ollydbg v1 to v2 porting question sendersu General Discussion 0 09-02-2014 13:29
porting GNU tdestroy() function to SPARC Solaris WhoCares General Discussion 3 01-07-2005 23:53


All times are GMT +8. The time now is 06:43.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )