[mpich-discuss] problem of calling .dll in mpich

Vivian viviantj at gmail.com
Fri Dec 5 00:05:24 CST 2008


Hi,
      I met some problems when I was trying to call a dll in a mpich program
(Language:VS 2005).
      (1) MPICH seems to only support calling convention  _cdecl.
          When I change the project setting to _stdcall, the code cannot be
successfully built.
          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.
          Under debugging mode or directly run in command window (
c:>test.ext), there is no problem to call dll in the code.
          Here is the code:

--------------------------------------------------------------------------------

     typedef char (__stdcall *AVRUN) (char[100]);
     HINSTANCE ArcviewDLL;
     AVRUN AVRun;
     ArcviewDLL= LoadLibraryA("Avhelp.dll");
     AVRun = (AVRUN) GetProcAddress(ArcviewDLL, "AVRun");

    AVRun("av.run(\"HAO_script3\",\"\")");

-------------------------------------------------------------------------------

      (2) However, the program fails to call dll when I use "mpiexec" to run
it. (c:>mpiexec -n 1 test.exe).
           It seems to "stop" right before this line
  -------------------------------------------------------------
    AVRun("av.run(\"HAO_script3\",\"\")");
  -------------------------------------------------------------
          Is there anyone having any idea why this happens?

--
Vivian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20081205/ca02afd5/attachment.htm>


More information about the mpich-discuss mailing list