Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Using U++ with existing code
Re: Using U++ with existing code [message #24921 is a reply to message #24917] Thu, 04 February 2010 15:46 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1791
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

TRNG98 wrote on Thu, 04 February 2010 14:47

I have an existing C program that do all the work I need.
Can I connect this with an U++ application, best would compile them together? I need very little integration, some static global variables would do. Can absolutely not translate the C program
to U++.

//
Best regards
Bo


Hi Bo!
Since C is a subset of C++ and U++ is still just C++, there is technically no problem in using them together. Also TheIDE is aware of the difference between .c and .cpp files, so if you just add your existing files into the project, they should be compiled and linked correctly. A little work will be needed to bind the two parts (U++ and C) correctly, but that depends a lot on what do you want to do.

Typical case I can imagine would be writing U++ GUI for C console program. In that case, you would just write the GUI part, calling existing functions from the original sources (including necessary headers of course). Commenting out the original main() or renaming it is probably the only big change you would have to do in original sources in this case. This is just an example, if you supply more info, we can probably give you better hints Wink

If you want to see a practical example, you can have a look into package uppsrc/plugin/ndisasm. That is package that includes C sources of libndisasm to provide disassembler used in TheIDE. It's probably not the best example (it won't compile as standalone app anymore, not sure why Confused ), but it should give you an idea about mixing U++ and C. Actually, most of the packages in uppsrc/plugin are using existing C code, so just have a look in that direction Wink

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: header file problem
Next Topic: Build error
Goto Forum:
  


Current Time: Wed May 14 11:48:38 CEST 2025

Total time taken to generate the page: 0.01354 seconds