![]() |
|
|
|
#1
|
|||
|
|||
|
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 |
|
#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 |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
Quote:
To get a real benefit, you should try to catch the algorithm(s) used and reimplement them from scratch ... Kerstin |
|
#8
|
|||
|
|||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |