Please login with a confirmed email address before reporting spam
The printf() statement is part of the source code for the dll you generate with Visual C. No link of MS Visual C and Comsol needed. Comsol simply calls the dll and executes it.
Here is a code example, adapt it to your needs. Remove the outer commenting: /* */. It ran under Windows 7. Don't close the console manually. This will crash Comsol. It closes when Comsol closes.
/*
//START Debugging Console Window output
//The following code opens a console window for debugging purposes; mainly to check for
//correct reception of submitted fields and parameters
//Handle this with care - it can crash your machine - backup often!
static int counter = 1;
if (counter == 1)
{
AllocConsole();
freopen("CONOUT$", "w", stdout);
printf("COMSOL Multiphysics at work \r\n");
printf("Opened Console after first call to external material routine \r\n\n");
}
if(counter % 10000 == 0)
printf("Call Nr.: %7d Br = %-+5.3f Bphi = %-+5.3f Bz = %-+5.3f\r", counter, B[0], B[1], B[2]);
counter = counter + 1;
//END Debugging Console Window output
*/
Just saw that the forum software messes up the format, so added some linefeeds.
-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
The printf() statement is part of the source code for the dll you generate with Visual C. No link of MS Visual C and Comsol needed. Comsol simply calls the dll and executes it.
Here is a code example, adapt it to your needs. Remove the outer commenting: /* */. It ran under Windows 7. Don't close the console manually. This will crash Comsol. It closes when Comsol closes.
/*
//START Debugging Console Window output
//The following code opens a console window for debugging purposes; mainly to check for
//correct reception of submitted fields and parameters
//Handle this with care - it can crash your machine - backup often!
static int counter = 1;
if (counter == 1)
{
AllocConsole();
freopen("CONOUT$", "w", stdout);
printf("COMSOL Multiphysics at work \r\n");
printf("Opened Console after first call to external material routine \r\n\n");
}
if(counter % 10000 == 0)
printf("Call Nr.: %7d Br = %-+5.3f Bphi = %-+5.3f Bz = %-+5.3f\r", counter, B[0], B[1], B[2]);
counter = counter + 1;
//END Debugging Console Window output
*/
Just saw that the forum software messes up the format, so added some linefeeds.