- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm an old dog, and new tricks don't come easy. I'm trying to setup an interface block in a module for a routine which takes the name of a subroutine as one its arguments, and I'm stumped. The argument "callback" will be the name of a subroutine which takes one input argument of the same type as the handle variable. How does one declare the procedure argument?
INTERFACE function TF_SetLeaseCallback(handle, callback) bind(c, name = 'TF_SetLeaseCallback') result(retval) import integer(c_int32_t), value :: handle WHATGOESHERE :: callback integer(c_long) :: retval end function subroutine callback(status) integer(c_int32_t) :: status end subroutine END INTERFACE
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will study the code in quote #19 later today.
I have the C header file for the C library. It is named Turbofloat.h and I have tried to attach it. Here is the prototype for the C routine which takes a routine name as its second argument.
TURBOFLOAT_API HRESULT TF_CC TF_SetLeaseCallback(uint32_t handle, LeaseCallbackType callback);
Looking elsewhere in the header file for the other definitions.......
define TURBOFLOAT_API __declspec(dllimport) define TF_CC __cdecl typedef void(TF_CC * LeaseCallbackType)(uint32_t);
HRESULT seems to be coming from winnt.h as typedef _Return_type_success_(return >= 0) long HRESULT;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
typedef int32_t HRESULT;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
andrew_4619 wrote:typedef int32_t HRESULT;
If that C code (TURBO FLOAT?) is based on Microsoft Windows header(s), then better to follow Microsoft's own documentation:
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types
which defines HRESULT as
typedef LONG HRESULT;
with
typedef long LONG;
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »