Re: Non-dotnet DLLs: brick wall hit
From: Jeff Gaines (whitedragon_at_newsgroup.nospam)
Date: 01/05/05
- Next message: Alexander Wehrli: "Getting remote Logon User"
- Previous message: thomas: "Re: c# include c++ and debugging"
- In reply to: GaryJones: "Re: Non-dotnet DLLs: brick wall hit"
- Next in thread: Chris Jobson: "Re: Non-dotnet DLLs: brick wall hit"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 05 Jan 2005 03:59:39 -0800
On 04/01/2005 GaryJones wrote:
> The structures I actually need to use are very large (around 200 data
> items being passed into the DLL, and a similar number in the returned
> structure), so I'm just trying to get a trivial example working in C#.
> To test things, I've written a silly little Delphi DLL which works the
> way I'm familiar with; it accepts two pointers: one to the data to be
> processed, and the other to the results to be populated.
I installed D7 to try and build your dll but it just reminded me of all
the reasons I gave up on Delphi :-(
The following works in a C# app:
struct TinData
{
public int i;
public StringBuilder s;
}
struct ToutData
{
public int i;
public StringBuilder s;
}
private void dllCore(ref TinData tin, ref ToutData tout)
{
tout.i = tin.i;
tout.s = tin.s;
}
private void btnTest_Click(object sender, System.EventArgs e)
{
JTest();
}
private void JTest()
{
TinData tinTemp = new TinData();
tinTemp.i = Convert.ToInt32(txti.Text);
tinTemp.s = new StringBuilder();
tinTemp.s.Append(txts.Text);
ToutData toutTemp = new ToutData();
toutTemp.s = new StringBuilder();
dllCore(ref tinTemp, ref toutTemp);
lbli.Text = toutTemp.i.ToString();
lbls.Text = toutTemp.s.ToString();
}
However it may be meaningless when it meets the dll!
I put together a test Form which has TextBoxes txti and txts, Labels
lbli and lbls and a Button btnTest.
By passing the two data structures as 'ref' they are effectively
pointers but I'm not sure how Delphi will react?
If you want to post the dll or its source I am happy to have a play, or
perhaps somebody else will pop in with some ideas.
-- Jeff Gaines Posted with XanaNews 1.17.1.2 http://www.wilsonc.demon.co.uk/delphi.htm
- Next message: Alexander Wehrli: "Getting remote Logon User"
- Previous message: thomas: "Re: c# include c++ and debugging"
- In reply to: GaryJones: "Re: Non-dotnet DLLs: brick wall hit"
- Next in thread: Chris Jobson: "Re: Non-dotnet DLLs: brick wall hit"
- Messages sorted by: [ date ] [ thread ]