How do I access a DLL written in C++ that I have no access to modify from a rad 10 Delphi application
I have this info on the DLL
public sealed class RNGInfernoServiceManager
public const long Zero = 0;
public const long OneBillion = 1000000000;
public static readonly RNGInfernoServiceManager
Current = new RNGInfernoServiceManager();
public long CreateArrayOfRandomNumbers(uint arraySize = 1,
long min = Zero,
long max = OneBillion);
public class CryptoRandom : System.Random
public override int Next();
public override int Next(int maxValue);
public override int Next(int minValue, int maxValue);
public override void NextBytes(byte buffer);
public void NextBytes(byte buffer, int offset, int count);
public byte NextBytes(int count);
public override double NextDouble();
public long NextLong();
public long NextLong(long maxValue);
public long NextLong(long minValue, long maxValue);
Even so, there are only 2 ways to use a DLL in Delphi:
- if the DLL exports flat C style functions.
- if the DLL exposes access to COM objects.
Is your DLL doing either of those? Based on the code you showed, it doesn't appear to be doing so.
That being said, your Delphi code does not match the DLL code you have shown. In the DLL, RNGInfernoServiceManager() and CryptoRandom() are class constructors, not standalone procedures. And CreateArrayOfRandomNumbers() is a class method, not a standalone function, and it returns a dynamically allocated array, not a fixed-sized array.
Even if they were standalone procedures/functions exported by the DLL, like your Delphi code is expecting, your Delphi code is not declaring any calling convention for them, so Delphi's 'register' calling convention will be used, which is not compatible with ANY other compiler except for C++Builder (via its __fastcall calling convention). Most compilers use 'cdecl' or 'stdcall' instead when exporting functions for other compilers to call.
dwight wrote: attached is the documentation I have for this DLL
There is no attachment present. And even if there were, my experience with this forum server is that attachments simply don't work anyway. Even if the forum shows an attachment is present, it never lets me click on them.