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 » Developing U++ » UppHub » New packages announcement
Re: New packages announcement [message #21999 is a reply to message #21997] Sun, 14 June 2009 15:55 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3361
Registered: August 2008
Senior Veteran
Hello ptDev

These are the main methods in Tcc class:

void Compile(const char *my_program);
void AddSymbol(const char *funName, void *fun);
void *GetSymbol(const char *funName);
void Relocate();


And this is the detail of a demo:

tcc.Compile(my_program);
tcc.AddSymbol("myFunction", (void *)&myFunction);
tcc.Relocate();
double (*myMain)(char *str) = (double (*)(char *str))tcc.GetSymbol("myMain");
printf("\nThe result for Test is %.1f", myMain("Hello"));


where:
- my_program is a text with the source code
- myFunction is a function in the main program that can be called from the tcc program
- myMain is a function in the tcc program that can be called from the main program

It is like a dinamic linking to a program that can be done on the fly, and also this program can call to caller program functions.

Tcc also lets to do standalone programs but I have done the class to only compile and run a program in memory.

Best regards
Koldo


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Fast memory pool with tests
Next Topic: Improved SliderCtrl?
Goto Forum:
  


Current Time: Sat May 11 14:52:54 CEST 2024

Total time taken to generate the page: 0.02192 seconds