Re: C# - Problem to receive data from a C++ Dll



Try this
private static extern void GetSN([MarshalAs(UnmanagedType.LPStr)] String s);


U¿ytkownik "Gandalf" <Gandalf@xxxxxxxxxxxxxxxxxxxxxxxxx> napisa³ w
wiadomo¶ci news:037A7653-13B5-40F2-BA79-8753FC81FF2D@xxxxxxxxxxxxxxxx
> Hi,
>
> I followed the document you showed me, but I have when I debug the
following
> message : System.MissingMethodException.
>
> I don't understand why, now I'm using the following code.
>
> Declaration of the dll in the C # program :
>
> ---------------------------------------------------------
> [DllImport("Intermec7xxInfo.dll",EntryPoint="GetSN")]
> private static extern void GetSN(StringBuilder s);
> .....
> // Call to the dll
> StringBuilder valueStr = new StringBuilder("");
> ...
> GetSN(valueStr);
> ...
> -----------------------------------------------------------
>
> And my dll function in C++ is the following.
> -------------------
> ...
> extern "C" void GetSN(LPTSTR str)
> ...
> -------------------
>
> Perhaps the problem is that I'm using a program destinated to Pocket PC ?
> However, I can download the dll on the device which is on Pocket PC 2003,
I
> have no error, so I suppose that there is no error with the dll...
>
> If you have any idea...
>
> Thanks in advance.
>
>
> "Tegdeep" wrote:
>
> > That's pretty strange. The problem could be with the way you try to
> > get the data. See if you find anything on this website :
> >
> > http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/
> >
> > It discusses unmanaged DLL's in C# .
> > Let me know what the solution is, if you find it.
> >
> >


.



Relevant Pages

  • Re: Calling a matlab DLL from C#?
    ... don't use with strings being passed to your DLL! ... to each of the outgoing string params. ... private static extern bool mclInitializeApplication(string ... private static extern void mclTerminateApplication; ...
    (comp.soft-sys.matlab)
  • Re: PocketPC C# COM interop - NotSupportedException ?
    ... private static extern void AccCreateSession( ... I'm pretty new to pocket pc development and COM in general. ...
    (microsoft.public.pocketpc.developer)
  • Re: Calling a matlab DLL from C#?
    ... don't use with strings being passed to your DLL! ... to each of the outgoing string params. ... private static extern bool mclInitializeApplication(string ... private static extern void mclTerminateApplication; ...
    (comp.soft-sys.matlab)
  • Re: C# - Problem to receive data from a C++ Dll
    ... Declaration of the dll in the C # program: ... private static extern void GetSN; ... However, I can download the dll on the device which is on Pocket PC 2003, I ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# - Problem to receive data from a C++ Dll
    ... I looked the parameters of the dll. ... private static extern void GetSN; ... > I think you can use a char type variable and it'll do a conversion by ...
    (microsoft.public.dotnet.languages.csharp)