>>The only thing I can think of is
>>
>>Changed
>>(1) CallingConvention.StdCall
>>(2) Use IntPtr for the dll return value, then convert IntPtr to string
>>
>>
>> //declare string Invoke1 in (addbs(justpath(.cProgramPath)) + "ww_local.dll") as ww_localInvoke string cInvokeString
>>
>> [DllImport(@"C:\Program Files (x86)\Siriusware\Pool\ww_local.dll",
>> ExactSpelling = false,
>> CallingConvention = CallingConvention.StdCall,
>> CharSet = CharSet.Auto)]
>> static extern IntPtr Invoke1([MarshalAs(UnmanagedType.LPTStr)] String str);
>>
>>
>>
>>
>>then
>>
>>string translate = Marshal.PtrToStringAuto(Invoke1(invoke));
>>
>>return translate ;
>>
>
>With the new dll I am now getting:
>
>Managed Debugging Assistant 'PInvokeStackImbalance' occurred
> Message=Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Siriusware.Middleware!Siriusware.Middleware.ValidationPass::Invoke1' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
>
>But no crash as before.
Try to change the CallingConvention
Gregory