|
using System;
using System.Runtime.InteropServices;
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class MyDLL {
[DllImport("legacy",EntryPoint = "MyAppend",ExactSpelling = true,CharSet = CharSet.Ansi,CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe IntPtr Append(
IntPtr ptr,
[MarshalAs(UnmanagedType.LPStr)]
string arg1,
[MarshalAs(UnmanagedType.LPStr)]
string arg2,
[MarshalAs(UnmanagedType.LPStr)]
string arg3, bool isLast);
[DllImport("legacy",EntryPoint = "KillBuffer",ExactSpelling = true,CharSet = CharSet.Ansi,CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void StringDispose(IntPtr ptr);
}
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
IntPtr target = IntPtr.Zero;
target = MyDLL.Append(target,"xx","yy","zzz",false);
target = MyDLL.Append(target,"xx","yy","zzz",false);
target = MyDLL.Append(target,"xx","yy","zzz",true);
Console.WriteLine("Returned: {0}",Marshal.PtrToStringAnsi(target));
MyDLL.StringDispose(target);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Student in last year at Faculty of Automatic Control and Computers of Polytechnical University Bucharest.
I like programming a lot, working with many languages like C++, VB, VB.Net, C#.
Now I'm working at United Management Technologies Romania in C++.