Shekar 0 Posted July 8, 2019 In 2011, I had made a DLL of ICS components using Delphi 2006. I have been using this DLL since then. I decided to make a new DLL with the latest ICS release on Delphi 10.2. I created a DLL project and added all the ICS source files and compiled. When I am using the new DLL instead of the old one, my VS C# exe is not able to create the socket component. I think I missed some step in the DLL creation as I have not done it for the last 8 years and google is not helping. I think I should add something to the exports section to make the socket component visible to the world, but I couldn't find any help in this regard. Can somebody giving me a link or some other help which will point me in the right direction? Thanks. Share this post Link to post
Angus Robertson 574 Posted July 8, 2019 Do you mean the exports are not in the DLL, you can use a DLL exports viewer to check that. the Windows Kit has one, lots of others around. For a DLL, you need a library dpr with an exports section, which I assume you created yourself. It may need updating with changes over many years. Or perhaps you are only exporting functions you wrote, and not the entire library? What version of ICS were you using before, in OverbyteIcsWSocket.pas? Angus Share this post Link to post
Shekar 0 Posted July 8, 2019 Hi Angus, I had made the library dpr in 2011. I lost it long time ago and do not remember whether I wrote anything in the exports section. Now I made a new library dpr, added all the pas file from ICS source folder and compiled. I got a dll. Using a dll viewer I can see 3 procedures _dbk_fcall_wrapper, dbkFCallWrapperAddr and TMethodImplementationIntercept. When I tried the same with my old ICS dll, the viewer shows nothing. I want to access the entire TWSocket class (both client and server) in visual studio C#. The current VS C# code is like this : public TWSocketClient ITSSocket = new TWSocketClient(); ITSSocket.OnSessionConnected += new TSessionConnected(ITS_OnConnected); ITSSocket.OnDataAvailable += new TDataAvailable(ITS_OnDataIn); ITSSocket.OnSessionClosed += new TSessionClosed(ITS_OnDisconnected); private void ITS_OnDataIn(object Sender, ushort ErrorCode) { //code to receive the data and process it } I have attached the old dll and the new dpr file and the new dll. . Thanks Shekar Ics2.dpr OverByteIcsOld.Dll OverByteICSNew.zip Share this post Link to post
Angus Robertson 574 Posted July 8, 2019 So you have lost the ICS source code for your old dpr? But not the DLL itself, so you can check to see what exports you created and replicate it for your new DLL. You should not need our help. Angus Share this post Link to post
Shekar 0 Posted July 8, 2019 The DLL Viewer displays blank for the old DLL. Share this post Link to post
Angus Robertson 574 Posted July 8, 2019 Accessing Delphi objects from C# is very unusual, was not aware it could be done. It's certainly not something we can support here. You would presumably need c# headers as well, or whatever than language uses. Creating DLLs using ICS is common, there are examples in samples, but they export complete functions, not the components themselves and always use a thread with a message handler. Angus Share this post Link to post
FPiette 383 Posted July 8, 2019 Creating a DLL project and adding all ICS source code is not enough ! You have to export the function you want to have and since you use C#, no export function can have arguments or return value other than simple C data types. You also have to pay attention to strings and characters: in D2006, there where ASCII. Now they are Unicode (C# support unicode as well). Since you are using your old DLL, it is likely that you exactly know which functions are exported and which argument they have. You should reproduce than. Share this post Link to post