Jump to content
Shekar

ICS DLL for Visual Studio

Recommended Posts

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

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

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

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

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

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

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
×