- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a library that I can link, that has a function to create a GUID ? Using Fortran 11.1.048 on VS 2008.n 11.1.048 on VS 2008.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CoCreateGuid - it ought to be in module OLE32 but isn't. So declare it yourself. For example:
[fortran]use ifwinty interface function CoCreateGuid (pguid) import !DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"CoCreateGuid" :: CoCreateGuid integer(LONG) :: CoCreateGuid type(T_GUID), intent(OUT) :: pguid end function CoCreateGuid end interface !DEC$ OBJCOMMENT LIB:"ole32.lib" type(T_GUID) :: my_guid integer(LONG) :: res res = CoCreateGuid (my_guid) if (res ==S_OK) then print 101, my_guid%data1,my_guid%data2,my_guid%data3,my_guid%data4(1:2), & my_guid%data4(3:8) 101 format (Z8.8,'-',Z4.4,'-',Z4.4,'-',Z4.4,'-',Z12.12) else print *, "Error ", res end if end[/fortran]
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CoCreateGuid - it ought to be in module OLE32 but isn't. So declare it yourself. For example:
[fortran]use ifwinty interface function CoCreateGuid (pguid) import !DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"CoCreateGuid" :: CoCreateGuid integer(LONG) :: CoCreateGuid type(T_GUID), intent(OUT) :: pguid end function CoCreateGuid end interface !DEC$ OBJCOMMENT LIB:"ole32.lib" type(T_GUID) :: my_guid integer(LONG) :: res res = CoCreateGuid (my_guid) if (res ==S_OK) then print 101, my_guid%data1,my_guid%data2,my_guid%data3,my_guid%data4(1:2), & my_guid%data4(3:8) 101 format (Z8.8,'-',Z4.4,'-',Z4.4,'-',Z4.4,'-',Z12.12) else print *, "Error ", res end if end[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I works great ! and on x64 as well. Thanks
![](/skins/images/872293744008A34B36F8ABF94A46CC66/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page