Hi,<br> I met some problems when I was trying to call a dll in a mpich program (Language:VS 2005).<br> (1) MPICH seems to only support calling convention _cdecl. <br> When I change the project setting to _stdcall, the code cannot be successfully built.<br>
So I set the project setting back to _cdecl and force the calling convention of the function pointer to my function on the DLL to be "_stdcall". This time the program is built. <br> Under debugging mode or directly run in command window ( c:>test.ext), there is no problem to call dll in the code.<br>
Here is the code:<br> -------------------------------------------------------------------------------- <br> typedef char (__stdcall *AVRUN) (char[100]); <br>
HINSTANCE ArcviewDLL; <br>
AVRUN AVRun;<br>
ArcviewDLL= LoadLibraryA("Avhelp.dll"); <br>
AVRun = (AVRUN) GetProcAddress(ArcviewDLL, "AVRun");<br>
<br>
AVRun("av.run(\"HAO_script3\",\"\")");<br> -------------------------------------------------------------------------------<br><br> (2) However, the program fails to call dll when I use "mpiexec" to run it. (c:>mpiexec -n 1 test.exe).<br>
It seems to "stop" right before this line<br> -------------------------------------------------------------<br> AVRun("av.run(\"HAO_script3\",\"\")");<br> -------------------------------------------------------------<br>
Is there anyone having any idea why this happens?<br clear="all"><br>--<br>Vivian<br>