- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am converting my win32 application to 64bit version and I have problem with beginthreadex function. Interface for this function is not present in IVF include files.
Where I can find interface for this function?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a MSVC library routine, with special hooks into the MSVC runtime, not a Windows API routine.Use CreateThread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try this:
[fortran]
! Interfaces to Microsoft Visual C library thread routines
! Must link against multithreaded libraries
interface
function $beginthreadex (security, stack_size, start_address, arglist, &
initflag, thrdaddr)
use ifwinty
integer(UINT) :: $beginthreadex
!DEC$ ATTRIBUTES C, alias:"__beginthreadex" :: $beginthreadex
type(T_SECURITY_DESCRIPTOR), intent(IN) :: security
!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: security
integer(UINT), intent(IN) :: stack_size
integer(PVOID), intent(IN) :: start_address ! Must be STDCALL calling was (PVOID)
! mechanism, 1 arg
integer(PVOID), intent(IN) :: arglist
integer(UINT), intent(IN) :: initflag
integer(UINT), intent(OUT):: thrdaddr
!DEC$ ATTRIBUTES REFERENCE,IGNORE_LOC :: thrdaddr
end function $beginthreadex
end interface
[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To Steve Lionel: Thanks for response I expected it is API function. Now I understand why it is not part of IVF headers.
To Paul Curtis: Thanks for Your example. I already use very similar interface, but it seems to work only for win32. When I compile my code for x64 I obtain error:
error LNK2019: unresolved external symbol __beginthreadex referenced in function xxx
I suppose problem is in two initial underscores. I am little bit confused in naming conventions of x64.
You have no problems to compile x64 with Yours interface?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following is from old code and "works" but should be updated to use the inter-operational feature for DWORD
! use ControlPanel as thread_func integer(INT_PTR_KIND()) :: ControlPanelArg = 0 integer(4) :: ControlPanelFlags = 0 integer(INT_PTR_KIND()) :: ControlPanelThread_ID = 0 INTERFACE integer(4) FUNCTION ControlPanel(arg) !DEC$ ATTRIBUTES STDCALL, ALIAS:"_controlpanel" :: ControlPanel integer(4),POINTER :: arg END FUNCTION END INTERFACE ................... ! Create seperate thread to run the Modal Dialog control pannel ControlPanelHandle = CreateThread(& & NULL, ControlPanelStack, loc(ControlPanel), loc(ControlPanelArg), ControlPanelFlags, loc(ControlPanelThread_ID)) ...................... integer(4) FUNCTION ControlPanel(arg) !DEC$ ATTRIBUTES STDCALL, ALIAS:"_controlpanel" :: ControlPanel USE IFLOGM use GlobalData implicit none INCLUDE 'RESOURCE.FD' integer(4),POINTER :: arg .......
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use this instead:
!DEC$ ATTRIBUTES C, DECORATE, alias:"_beginthreadex" :: $beginthreadex

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page