🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.delphi
3 messages
3 total messages Started by mmm Thu, 16 Nov 2017 14:16
[ot] integracja z projektem c#
#346175
Author: mmm
Date: Thu, 16 Nov 2017 14:16
22 lines
1464 bytes
Integruje projekt Delphi z projektem C#,

komunikacja za pomocą COM (c# eksportuje obiekty a Delphi używa) działa 
to prawie OK ale nie idealnie, muszę przerobić na DllExport

Kombinuje aby projekt c# eksportował w standardowy sposób funkcje jak w "C".


W jaki sposób funkcja C# może zwrócić string do Delphi ? Bo o ile w 
wersji COM to by zadziałało to juz z użyciem "DllExport" nie zadziala 
bo typ "string" w C# i Delphi to zupełnie co innego !

         [DllExport]
         static string WebServiceURL()
         {
             string str = DajWebServiceURL();
             return str;
         }

Jak przerobić taka funkcje c# ?

M
Re: [ot] integracja z projektem c#
#346176
Author: mmm
Date: Thu, 16 Nov 2017 17:57
23 lines
1359 bytes
>          [DllExport]
>          static string WebServiceURL()
>          {
>              string str = DajWebServiceURL();
>              return str;
>          }
> 
> Jak przerobić taka funkcje c# ?
> 
> M
https://stackoverflow.com/questions/35306309/call-dotnet-from-delphi-and-return-a-string

[DllExport]
public static void WebServiceURL(
     [MarshalAs(UnmanagedType.BStr)]
     ref string s
)
{
     s = DajWebServiceURL();
}

M
Re: [ot] integracja z projektem c#
#346177
Author: roland.rusiecki
Date: Fri, 24 Nov 2017 23:06
6 lines
1690 bytes
https://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports

Zerknij na tą bibliotekę, to chyba wygodniejsze rozwiązanie, inne to robienie wrapperów przez C++ CLI
Przerobiłem i jedno i drugie wg mnie com, jest mniej praktyczny przy wdrożeniach.

Pozdrawiam Roland
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads