Jump to content
psla314

A class named TOAuth1SignatureMethod_PLAINTEXT already exists.

Recommended Posts

Hi

 

I am using the Delphi Rest Client and OAuth libraries from the units

   REST.Utils,
   REST.Types,
   REST.Client,
   REST.Authenticator.OAuth,
   REST.Authenticator.OAuth.WebForm.Win

 

I have two dll's that uses these units successfully and both have runtime packages turned on for xmlrtl;vcl;vclx;rtl

However when I try to load both dll's in the same exe, I get the following exception.

 

exception class    : EFilerError
exception message  : A class named TOAuth1SignatureMethod_PLAINTEXT already exists.

 

Because the rest code seems to be in the rtl package, and both dll's are loading rtl package at runtime, I thought it should be ok, but apparently not.

This class  TOAuth1SignatureMethod_PLAINTEX  is in REST.Authenticator.OAuth unit in C:\Program Files (x86)\Embarcadero\Studio\19.0\source\data\rest

 

At the bottom of this file is the cause

 

initialization
  RegisterClasses([TOAuth1SignatureMethod_PLAINTEXT, TOAuth1SignatureMethod_HMAC_SHA1]);
 

 

Does anyone have any ideas how to resolve this ?

 

Regards

Peter

 

Bug report below running in 64 bit.

 

Username           : peter
date/time          : 2020-11-20, 10:59:23, 388ms
computer name      : PETER
user name          : peter
registered owner   : peter
operating system   : Windows 10 x64 build 19041
system language    : English
system up time     : 3 days 21 hours
program up time    : 2 minutes 47 seconds
processors         : 12x Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
physical memory    : 4135/16235 MB (free/total)
free disk space    : (C:) 242.90 GB
display mode       : 2560x1440, 32 bit
process id         : $5f54
allocated memory   : 1.60 GB
largest free block : 130989.73 GB
executable         : prog.exe
exec. date/time    : 2020-11-20 09:15
version            : 10.4.0.0
compiled with      : Delphi 10.2 Tokyo
madExcept version  : 5.0.99
callstack crc      : $398bae85, $14cecb7b, $317ff7bb
exception number   : 1
exception class    : EFilerError
exception message  : A class named TOAuth1SignatureMethod_PLAINTEXT already exists.

main thread ($6668):
033dcc0c +0cc rtl250.bpl
033de3fd +02d rtl250.bpl     System                             Classes.RegisterClass
033de48e +01e rtl250.bpl     System                             Classes.RegisterClasses
0328a309 +139 rtl250.bpl     System                             _StartLib
7ffd4d02 +0df ntdll.dll                                         LdrLoadDll
7ffd4ab8 +15b KERNELBASE.dll                                    LoadLibraryExW
08502849 +049 MACM.dll       unModuleInterface          164  +4 TModuleInterface.OpenLibrary
0880de40 +010 MACM.dll       unRestInterface            213  +1 TRESTInt.OpenLibrary
08502673 +0a3 MACM.dll       unModuleInterface          106  +9 TModuleInterface.Create
0880dd4b +08b MACM.dll       unRestInterface            204  +1 TRESTInt.Create

 

 

 

 

 

Share this post


Link to post
1 hour ago, psla314 said:

Because the rest code seems to be in the rtl package

Are you sure about that?  I don't use the REST stuff, but seems to me like that should be in its own separate package, not cluttering the RTL.  Just because the exception's stack trace mentions rtl250.bpl does not mean the REST stuff resides in the RTL itself.  The runtime class registration functionality is in the RTL, which other packages can then call into to share their classes with each other (among other things).  I suggest you hunt down the real package that the REST stuff actually resides in, and make sure your 2 DLLs are using that package dynamically rather than statically.

Edited by Remy Lebeau

Share this post


Link to post

Good point, I'll see if I can find the package the Rest code resides in, thanks for the feedback.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×