FW: Mixing C/C++ code
Marco Manfredini
mldb@gmx.net
Fri Nov 30 18:49:00 GMT 2007
On Friday 30 November 2007 11:12, Robert Wong wrote:
> I'm a CS student working on a project that mixes C/C++ compiling both with
> g++. If you have the time I was hoping you could help. I've described the
> problem with some depth here:
>
> http://forums.devshed.com/c-programming-42/calling-c-function-from-c-492886
>. html
According to the output:
<quote>
serviceRequests called
serviceRequests called - 1
init_sim_dram called
init_sim_dram completed
serviceRequests called - 1.25
serviceRequests called - 1.3
[and fault]
</quote>
(btw. where is "init_sim_dram halfway")
and your program code:
<quote>
ptr_mcsim_dram_config_info_t = &mcsim_dram_config_info_t;
std::cout << "serviceRequests called - 1.3" << endl;
std::cout << "serviceRequests called - 1.35" << endl;
//test();
configure_sim_dram(ptr_mcsim_dram_config_info_t);
std::cout << "serviceRequests called - 1.4" << endl;
</quote>
The fault happens before you attempt to call "configure_sim_dram" or "test".
I'm guessing from the printf-debugging that you can't easily run your program
in the debugger, but did you try to enable core dumps and inspect the state
of the crashed program post-mortem?
More information about the Gcc-help
mailing list