TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dave
NA
5
0
Delphi DLL in C#
Oct 29 2005 12:35 PM
Hi, I have a Delphi 6 DLL that I need to run from C#.Net 2.0. I have some problems with it though. Here Goes: The Delphi Decalration is : function M_Login(ip : PChar; port : LongInt; uci : PChar; vol : PChar; pass : PChar; user : PChar) : LongInt; stdCall; And the C# Declaration is : [DllImport("iMSMAPI.DLL", CallingConvention = CallingConvention.StdCall, CharSet=CharSet.Ansi)] private static extern Int64 M_Login(string ip, Int64 port, string uci, string vol, string pass, string user); This gives me an AccessViolationException at RunTime when I call M_Login. I can Change the Delphi Declaration to expect Strings instead of PChars, this avoids the AccessViolationError, but this causes the values passed to the Delphi DLL to be incorrect. i.e. contain characters that the C# Application did not pass. I passed the value "127.0.0.1" as the ip parameter in C# and when I inspected the ip parameter in Delphi it was '1'#0'2'#0'7'#0'.'#0'0' . Can anyone help. Thanks in Advance, Dave Shaw
Reply
Answers (
3
)
input MASK for datagrid
Please Help!