The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,854 other subscribers

Archive for the ‘Delphi’ Category

Smart Pointers code that compiles in FPC and Delphi

Posted by jpluimers on 2019/03/06

Delphi and FPC have different language boundaries, so it is always good to read a thread discussing how to get near-the-edge cases work in both.

This case is about Smart Pointers (here called auto pointers, maybe because auto_ptr is what they used to be called in C++): [WayBack] Hi all, I am trying to make a certain piece of code cross compile between Delphi and FPC. On FPC, it compiles fine but on Delphi I get a [dcc32 Error] P… – Ugochukwu Mmaduekwe – Google+

In the end if comes down to that Delphi does not allow forward-declaration of records (it does for interfaces and classes), but that you do not need a __PAutoPtr_T = ^__TAutoPtr_T, because you can use ^__TAutoPtr_T in parameters.

In Spring4D, they are called Shared/IShared/TShared, see my comment:

Note that since these are reference counted, you might want to call them shared_ptr. If you enforce the single-instance behaviour, observe that in C++ they are now called uniqe_ptr.

In Spring4D this rename has already taken place a while ago: https://bitbucket.org/sglienke/spring4d/commits/e252b81fd3788cf5b82588721f68d00c892deb87

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 2 Comments »

My contributions to RAD Studio – Jose León – Medium

Posted by jpluimers on 2019/02/28

For my link archive, as a reminder to check the Sistel JIRA tool, which is an IDE like tool for JIRA: [WayBack] Business Process Studio for JIRA | Sistel

He has some very interesting posts at [Archive.isJose León – Medium.

Via:

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Issue/Bug tracking, JIRA, Software Development | Leave a Comment »

Anyone who knows about http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Rio ?

Posted by jpluimers on 2019/02/28

It look likes sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Rio is gone (though docwiki has more than a couple 100 mentions of [Archive.is] “radstudiodemos” and [Archive.is] “RADStudio_Rio”), for instance here:

I have not seen an announcement of this branch disappearing, so I wonder what happened and why.

sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches was a great resource, as it had a consistent history from Delphi XE through 10.2 Tokyo (apparently there used to be 10.3 Rio too) that made it very easy to see the differences in various versions, giving a great indication of new features and differences in products, often before the docwiki got updated to reflect them.

SVN not being centralised, now makes this chain break for Delphi 10.3 Rio, which is quite a pity.

If anyone has the complete SVN history including Delphi 10.3 RIO, please let me know: Delphi 10.3 Rio Update 1 now finally being out likely means many more people start using it as initial issues found in the public have been fleshed out.

It would have been so much more convenient to have for instance a git converted repository keeping all the history and including Delphi 10.3 Rio somewhere.

If anyone has that, I’d be interested in that too. One can dream, right?

Sidenote

I bumped into this via a link pointing to URLs having these fragments in them, which are now invalid:

This means I have to fix some 150 links later: [Archive.is] site:wiert.me “radstudiodemos” – Google Search.

It looks like radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/trunk got replaced with sourceforge.net/p/radstudiodemos/code/HEAD/tree/trunk and https://svn.code.sf.net/p/radstudiodemos/code/trunk, which should give me a head-starting on how to fix the links.

–jeroen

 

 

Posted in Delphi, Delphi 10.3 Rio (Carnival), Development, Software Development | 1 Comment »

There can be only MS Office sample automation server wrapper components in RAD Studio

Posted by jpluimers on 2019/02/27

There are six variations; only one can be active at a time:

  • Delphi Office 2000 Servers Package
  • Delphi Office XP Servers Package
  • Delphi Office 2010 Servers Package
  • C++Builder Office 2000 Servers Package
  • C++Builder Office XP Servers Package
  • C++Builder Office 2010 Servers Package

via: I cannot get MS Office sample automation server wrapper components. Neither of… [WayBack]

More in depth article explaining all the nitty gritty details: There Can Only Be One! Handling Different Versions of Design Packages inside the IDE | The Art of Delphi Programming [WayBack]

–jeroen

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Did you know? 10.2 Tokyo has introduced 3 new warnings for Delphi compilers:…

Posted by jpluimers on 2019/02/27

Seems I forgot to push the “publish” button on this 2 years ago (:

Did you know?

10.2 Tokyo has introduced 3 new warnings for Delphi compilers:

Implicit integer cast with potential data loss from ‘<from>’ to ‘<to>’ W1071 IMPLICIT_INTEGER_CAST_LOSS Default: Off
Implicit conversion may lose significant digits from ‘<from>’ to ‘<to>’ W1072 IMPLICIT_CONVERSION_LOSS Default: Off
Combining signed type and unsigned 64-bit type – treated as an unsigned type W1073 COMBINING_SIGNED_UNSIGNED64 Default: On

Source: [WayBack] Did you know? 10.2 Tokyo has introduced 3 new warnings for Delphi compilers:…

Comment:

they were initially documented in less detail than the above table, and it keeps surprising me that you need to read employee blogs instead of the docwiki to keep current: [WayBack] New Warnings, Illegal Casts, and other Delphi compiler changes in 10.2 Tokyo.

Since then, documentation has improved to this:

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Any opinion on RAD Server vs Node.js/LoopBack vs TMS XData vs other?

Posted by jpluimers on 2019/02/26

Interesting thread still: [WayBack] Any opinion on RAD Server vs Node.js/LoopBack vs TMS XData vs other? – Kyle Miller – Google+

Tools mentioned there (not limited to Delphi):

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Thomas Mueller has started to write some documentation on the internal workings of GExperts…

Posted by jpluimers on 2019/02/26

From a while ago, for my link archive:

[WayBack] I have started to write some documentation on the internal workings of GExperts. For now, it covers only a very small part of the IDE form enhancement… – Thomas Mueller (dummzeuch) – Google+

Back then, this was done:

–jeroen

Posted in Delphi, Development, GExperts, Software Development | Leave a Comment »

Application shutdown: wait for all threads to terminate or not?

Posted by jpluimers on 2019/02/21

A while ago, I ran into a problem that an anonymous thread would run longer than the main thread of the application.

This caused all sorts of trouble, so in this case I decided to fix it for that particular thread.

There are various opinions if this should be done for all threads or not. Like always, it depends, so it is good to mention a few:

This particular case resulted into the memory manager shutting down earlier than the anonymous thread, but the anonymous thread was still using memory allocation functions, resulting into a few things of which you do not want the first and second to happen on a continuous integration system:

  1. Error messages during shutdown, which is unwanted on a headless system:
    ---------------------------
    MyIntegrationTests.exe: MM Operation after uninstall.
    ---------------------------
    FastMM has detected a GetMem call after FastMM was uninstalled.
    ---------------------------
    OK 
    ---------------------------

    or

    ---------------------------
    MyIntegrationTests.exe: MM Operation after uninstall.
    ---------------------------
    FastMM has detected a FreeMem call after FastMM was uninstalled.
    ---------------------------
    OK 
    ---------------------------

    either of them followed by

    ---------------------------
    Error
    ---------------------------
    Runtime error 203 at 00408EFF
    ---------------------------
    OK 
    ---------------------------

    or

    ---------------------------
    Error
    ---------------------------
    Runtime error 204 at 0040AFE9
    ---------------------------
    OK 
    ---------------------------

    The errors are mappings of:

    203, { reOutOfMemory }
    204, { reInvalidPtr }
  2. The MyIntegrationTests_MemoryManager_EventLog.txt to rapidly grow to 100s of megabytes.
  3. The MyIntegrationTests_MemoryManager_EventLog.txt not to be truncated.

This particular case was easy to fix by adding a global (but implementation section contained) boolean indicating if the thread was already finished:

unit DebugInformationLoaderUnit;

interface

implementation

uses
  JclDebug;

var
  LoadDebugInformationAsyncFinished: Boolean = False;

procedure LoadDebugInformationAsync;
begin
  TThread.CreateAnonymousThread(
    procedure
    begin
      TThread.NameThreadForDebugging('LoadDebugInforoamtionAsync');
      DebugInfoAvailable(MainInstance);
      LoadDebugInformationAsyncFinished := True;
    end).Start;
end;

initialization
  LoadDebugInformationAsync;

finalization
  while not LoadDebugInformationAsyncFinished do
  begin
    Sleep(1);
  end;
end.

In addition, I did this to suppress message boxes outside Delphi:

program MyIntegrationTests;

...

{$Include FastMM4Options.inc}

uses
  FastMM4 in '..\..\..\Shared\FastMM4.pas',
  System.Classes,
...;

{$R *.RES}

begin
  TThread.NameThreadForDebugging(ParamStr(0));

  SuppressMessageBoxes := SuppressMessageBoxes // follow pattern in FastMM4.FinalizeMemoryManager
    {$ifdef RequireIDEPresenceForLeakReporting}
        and DelphiIsRunning
    {$endif}
    {$ifdef RequireDebuggerPresenceForLeakReporting}
        and ((DebugHook <> 0)
        {$ifdef PatchBCBTerminate}
        or (Assigned(pCppDebugHook) and (pCppDebugHook^ <> 0))
        {$endif PatchBCBTerminate}
        )
    {$endif}
    ;
  {$WARN SYMBOL_PLATFORM OFF} NoErrMsg := {$WARN SYMBOL_PLATFORM ON} SuppressMessageBoxes; // Set RTL message boxes as well;

  ...
end.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Breaking in the Delphi debugger without a breakpoint

Posted by jpluimers on 2019/02/20

You can fire a debugger breakpoint using either of these two:

  • asm int 3 end which is the x86 debug interrupt
  • DebugBreak() which is the Windows API function wrapping the above interrupt

I’m not sure how accurate it is (in the past it would fail under some debuggers other than the Delphi IDE), but as of Delphi 2, there is a DebugHook variable that is non-zero when running under the Delphi debugger, so you can protect your code.

Via [WayBackI remember some time ago, Jeroen Pluijmers posted a snippet of how to place a breakpoint directly in the Delphi source without relying on the F5 key. – Alberto Paganini – Google+

Related:

–jeroen

Posted in Delphi, Development, Software Development, Windows Development | Leave a Comment »

cdecl: C gibberish ↔ English

Posted by jpluimers on 2019/02/20

Cool site if I ever need to decipher C declarations again: [WayBackcdecl: C gibberish ↔ English.

You can even store the C code as a URL.

via:

–jeroen

Posted in C, Delphi, Development, Software Development | 2 Comments »