Author Topic: Manifest and other ....  (Read 147 times)

0 Members and 1 Guest are viewing this topic.

jcfuller

  • Full Member
  • ***
  • Posts: 180
Manifest and other ....
« on: August 05, 2019, 11:25:43 AM »

This is more or less a reply to this post:https://www.oxygenbasic.org/forum/index.php?topic=1946.0;topicseen
with added stuff. I don't want to polute that topic.

Mike,
  I no longer use LinkRes2Exe as OxygenBasic was the only compiler that I use that needed it. With Charles last update I can retire it. I agree with the icon/version/manifest. I had heard of the version/manifest but not with the icon. I will start adding that also. This is the manifest I use for all coding. Most (if not all) is from Josť and his FreeBasic AFX Framework.
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

      <assemblyIdentity version="1.0.0.0"
         processorArchitecture="amd64"
         name="ApplicationName"
         type="win32"/>
      <description>Optional description of your application</description>

      <asmv3:application>
         <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
         </asmv3:windowsSettings>
      </asmv3:application>

      <!-- Compatibility section -->
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
         <application>
            <!--The ID below indicates application support for Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!--This Id value indicates the application supports Windows 8 functionality-->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!--This Id value indicates the application supports Windows 8.1 functionality-->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- This Id value indicates the application supports Windows 10 functionality-->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>           
         </application>
       </compatibility>

      <!-- Trustinfo section -->
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
         <security>
            <requestedPrivileges>
               <requestedExecutionLevel
                  level="asInvoker"
                  uiAccess="false"/>
               </requestedPrivileges>
         </security>
      </trustInfo>

      <dependency>
         <dependentAssembly>
            <assemblyIdentity
               type="win32"
               name="Microsoft.Windows.Common-Controls"
               version="6.0.0.0"
               processorArchitecture="amd64"
               publicKeyToken="6595b64144ccf1df"
               language="*" />
         </dependentAssembly>
      </dependency>

   </assembly>


On the bc9Basic side I am c++ only with VS2019. I do test apps on occasion with the NUWEN distro.
I found my first gotcha with TCLib/msvcrt.dll though which also will affect OxygenBasic unless Charles has found a way to use ucrtbase.dll

I received an email pointing out a problem with the time functions which I verified.
Output using vs2019 on Win 10 and gcc on Linux:
Code: [Select]
Mon Aug  5 14:52:11 2019
Today is Monday, August 05.
The time is 02:52 PM.
ISO week day is 2019W321.
Output from NUWEN and my bc9/TCLib:
Code: [Select]
Mon Aug 05 15:18:27 2019
Today is Monday, August 05.
The time is 03:18 PM.

"c" source
Code: [Select]
#include <time.h>
#include <stdio.h>
#define SIZE 256

int main (void)
{
  char buffer[SIZE];
  time_t curtime;
  struct tm *loctime;

  /* Get the current time. */
  curtime = time (NULL);

  /* Convert it to local time representation. */
  loctime = localtime (&curtime);

  /* Print out the date and time in the standard format. */
  fputs (asctime (loctime), stdout);

  /* Print it out in a nice format. */
  strftime (buffer, SIZE, "Today is %A, %B %d.\n", loctime);
  fputs (buffer, stdout);
  strftime (buffer, SIZE, "The time is %I:%M %p.\n", loctime);
  fputs (buffer, stdout);
  strftime (buffer, SIZE, "ISO week day is %GW%V%u.\n", loctime);
  fputs (buffer, stdout);
  return 0;
}

Reply from Stephan T. Lavavej (NUWEN)
This is almost certainly caused by MinGW's use of msvcrt.dll in Windows, which is an old version of the CRT. VS 2017+ uses ucrtbase.dll, the modern Universal CRT with C99 support.

I would be interested if anyone knows how to use ucrtbase.dll. I did search a bit but no luck with actual code.

James


jcfuller

  • Full Member
  • ***
  • Posts: 180
Re: Manifest and other ....
« Reply #1 on: August 05, 2019, 11:51:21 AM »
And the OxygenBasic code:
Code: [Select]

use rtl64
use console
use corewin

typedef unsigned long time_t
typedef unsigned int clock_t
% SIZE = 256
struct tm {
    int tm_sec;     /* seconds after the minute [0,60] */
    int tm_min;     /* minutes after the hour [0,59] */
    int tm_hour;    /* hours since midnight [0,23] */
    int tm_mday;    /* day of the month [1,31] */
    int tm_mon;     /* month since January [0,11] */
    int tm_year;    /* years since 1900 */
    int tm_wday;    /* days since Sunday [0,6] */
    int tm_yday;    /* days since January 1 [0,365] */
    int tm_isdst;   /* Daylight Saving Time flag */
}
Function main() As sys
  char buffer[SIZE]
  time_t curtime
  struct tm* loctime
  curtime = time(NULL)
  loctime = localtime(@curtime)
  buffer = (char*)asctime(loctime)
  print buffer
  strftime(buffer,SIZE,"Today is %A, %B %d.", loctime)
  print buffer cr
  strftime (buffer, SIZE, "The time is %I:%M %p.", loctime)
  print buffer cr
  strftime (buffer, SIZE, "ISO week day is %GW%V%u.", loctime)
  print buffer cr
  wait
End Function
main()

Mike Lobanovsky

  • Admin Support Member
  • *****
  • Posts: 1948
Re: Manifest and other ....
« Reply #2 on: August 06, 2019, 08:38:14 AM »
Hi James,

Re. your manifest file, I'd only suggest changing processorArchitecture="amd64" to processorArchitecture="*", which makes it applicable to both 32 and 64 bits.

Re. MinGW, I'm currently using the MinGW-w64 8.1.0 distro with Posix threads and Windows SEH in the Code::Blocks environment. This distro yields for me significantly smaller (up to 5 times) statically linked executables than its TDM GCC or NUWEN counterparts. It also offers Unix time.

Re. Unix time and VC, I'm using mostly MS VS2013. It's a Pro version that still covers all my needs. Like MinGW-w64 8.1.0, VS2013 also provides much of C99 and C++11 compatibility.

I do not think Charles will be able to develop a direct interface between Oxygen and C++ libraries. Such tasks are usually resolved through a dedicated proxy DLL that would black-box the C++ entity creation and caller engine, on the one side, while exposing only a simpler C-language compatible utility API, on the other side. The latter can then be utilized by other programming languages like OxygenBasic in a usual way.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

jcfuller

  • Full Member
  • ***
  • Posts: 180
Re: Manifest and other ....
« Reply #3 on: August 09, 2019, 01:37:27 AM »
Just a FYI; the source for ucrt is here on my machine:
C:\Program Files (x86)\Windows Kits\10\Source\10.0.17763.0\ucrt\

James