The mangled export symbol name should be ATUALIZAESTOQUENOVO_TESTE
but check the MAP or EXP file to be certain. Remember it’s Case Sensitive.
A better alternative would be to use a BSTRING in Clarion and Marshal it as a Unicode BSTR from C#. RAW is not required on a BSTRING it only passes the address and no length (the length is built into the BSTR type).
and the mangled export symbol name should be ATUALIZAESTOQUENOVO_TESTE
but check the MAP or EXP file to be certain.
Edit 2:00 pm
Added PASCAL per Oggy to correct these examples which removes @Fxxx from the mangled name. Also PASCAL is important for proper stack cleanup otherwise you’ll probably GPF on return to the caller.
Been that way couple of weeks ago. So, first of all, if you are using clarion composed dll in c# application, you MUST add pascal attribute to your exported dlls, procedures…
So, your procedure looks like: ```
AtualizaEstoqueNovo_Teste PROCEDURE (bstring pr),pascal. In that case you avoid to use exported flags: @FSB.
One more thing. If this is hand-coded project that you try to use in c# application? I also try this and neve succeeded. So better use application generator to create your procedures.
… and third, as Carl wrote, if you are using string parameter, on clarion side that MUST be bstring.
On C# side you are declaring you clarion proc as:
const UnmanagedType MYSTRING1 = UnmanagedType.BStr; // marshaled bstring
[DllImport(V, EntryPoint = " ATUALIZAESTOQUENOVO_TESTE ")] // importing your dll with pascal entry point
static extern void ATUALIZAESTOQUENOVO_TESTE([MarshalAs(MYSTRING1)] string MYSTRING1);
and now, calling looks like:
public void TestClarion()
string passedstring = "Test to pass to clarion "; // string with value that you will pass to clarion
… also, if you wish to return value from clarion to c#, use:
[DllImport(@"C:\\Test\\48\\prog\\ss007.dll", EntryPoint = "ATUALIZAESTOQUENOVO_TESTE")]
[return: MarshalAs(MYSTRING1)] // mandatory
public static extern string ATUALIZAESTOQUENOVO_TESTE([MarshalAs(MYSTRING1)] string MYSTRING1); // this is function (string), not void anymore
and in code, like in clarion:
somestring = ATUALIZAESTOQUENOVO_TESTE(yourstringparameter);
Of course, return parameter in clarion is bstring, so your declaration of clarion function would looks like;
AtualizaEstoqueNovo_Teste PROCEDURE (bstring pr),bstring,pascal
If I understood well, you need some help with clarion and c#?
Here is one small example, in zip file, the password for zip is: 1234.
In zip is clarion sample, and c# s clarionandcsharp.zip (9.1 MB)