Advertisement

06.12.2008 at 01:32PM PDT, ID: 23480998
[x]
Attachment Details

Import unmanaged DLL function

Asked by patrikt in C# Programming Language

I need to import unmanaged DLL fuunction to C#.
C++ function signature is:
char *fnname(const DWORD Id, char *buffer32, DWORD *UId, BYTE *Cid, BYTE *Mask, WORD *ID)

How should C# import look?
I crrently have:
extern static String fnname(Int32 Id,[MarshalAs(UnmanagedType.LPStr)] ref StringBuilder buffer32, Int32 UId,  byte CId,  byte Mask,ref Int16 ID);
This is runable (no exception) but not working. Problem is that buffer which should be preallocated to 32 bytes and should contain empty string.  C++ code receives something wrong.

I have no source code, only LIB and H files.

Start Free Trial
[+][-]06.12.2008 at 10:38PM PDT, ID: 21776201

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.12.2008 at 11:44PM PDT, ID: 21776433

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 11:58PM PDT, ID: 21776497

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.13.2008 at 12:04AM PDT, ID: 21776522

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.13.2008 at 12:17AM PDT, ID: 21776571

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.19.2008 at 11:04PM PDT, ID: 21828750

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Sign Up Now!
Solution Provided By: patrikt
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628