Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28501 Discussions

Calling API which is not included in Fortran

maciej
Beginner
357 Views
Hello,

It seems that not every Windows API subroutine can be accessed from Fortran. I think that it can be done, however.
Could anyone show an example of AfxEndThread function call from Fortran code?

regards,
Maciej
0 Kudos
1 Solution
Steven_L_Intel1
Employee
357 Views
AfxEndThread is an MFC (Microsoft Foundation Class) routine - it would typically be called from C++. I don't see in the MSDN documentation information on a supplied linkable library it is defined in.

It is true that there are some APIs which COULD be called from Fortran but don't have interfaces supplied. We add these as we can.

View solution in original post

0 Kudos
2 Replies
Steven_L_Intel1
Employee
358 Views
AfxEndThread is an MFC (Microsoft Foundation Class) routine - it would typically be called from C++. I don't see in the MSDN documentation information on a supplied linkable library it is defined in.

It is true that there are some APIs which COULD be called from Fortran but don't have interfaces supplied. We add these as we can.
0 Kudos
anthonyrichards
New Contributor III
357 Views
From what I read on the web, calling AFxEndThread from outside is not a good idea, e.g. "The problem with calling AfxEndThread yourself is that it won't unwind the stack and destroy local variables, which can cause memory leaks for objects". If you want to end a thread, use PostThreadmessage or PostQuitmessage().
0 Kudos
Reply