FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Using C# (and .NET) from FWH
Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Using C# (and .NET) from FWH

Posted: Tue Jun 26, 2018 04:58 PM
We have done a major advance on using C# (or any other .NET based language) from FWH :-)

This is going to be part of FWH 18.05

For now, please start testing this:

1. How to build a C# DLL:

test.cs
Code (fw): Select all Collapse
using System.Windows.Forms;

namespace dllNamespace
{
Β  Β  public class dllClass
Β  Β  {
Β  Β  Β  Β  public static int ShowMsg( string msg )
Β  Β  Β  Β  {
Β  Β  Β  Β  Β  Β  MessageBox.Show( msg );
Β  Β  Β  Β  Β  Β  return 0;
Β  Β  Β  Β  }
Β  Β }
}


To build it as a DLL do this:
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
csc /out:test.dll /target:library test.cs

Next: I will explain you how to run it from FWH 18.05 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3031
Joined: Fri Oct 07, 2005 01:45 PM

Re: Using C# (and .NET) from FWH

Posted: Tue Jun 26, 2018 07:42 PM

Antonio,

As you advance with this, perhaps you can keep in mind how we might turn a FWH program into a service. We've discussed this before, but never came to the point of an actual working service that can run in the background. We got builds, but it would not actually run. Maybe with this new technology we can actually accomplish that goal.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using C# (and .NET) from FWH

Posted: Wed Jun 27, 2018 01:39 PM
This is already working :-)

dotnet.prg
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

Β  Β FW_DotNet( "test.dll", "dllNamespace.dllClass", "ShowMsg", "C# from FWH" )

Β  Β FW_DotNet( "test.dll", "dllNamespace.dllClass", "ShowMsg", "yes!!!" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using C# (and .NET) from FWH

Posted: Wed Jun 27, 2018 02:05 PM

.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using C# (and .NET) from FWH

Posted: Wed Jun 27, 2018 02:15 PM

.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 894
Joined: Tue Oct 11, 2005 11:57 AM

Re: Using C# (and .NET) from FWH

Posted: Wed Jun 27, 2018 03:14 PM

Nice...
I will follow this topic, since I drop some developments because I couldn't access some .NET dll's and Libs

Greetins
From Chile
Adolfo

;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
Posts: 183
Joined: Tue Oct 18, 2005 10:01 AM

Re: Using C# (and .NET) from FWH

Posted: Thu Jun 28, 2018 12:56 PM

fantastic job, a big door is open now !

thank you.

Posts: 1068
Joined: Wed Nov 09, 2005 02:17 AM

Re: Using C# (and .NET) from FWH

Posted: Thu Jun 28, 2018 01:10 PM

It's really great!

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
BelΓ©m-Pa-Brazil
Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using C# (and .NET) from FWH

Posted: Thu Jun 28, 2018 05:24 PM

We are building a CLASS TDotNet ;-)

To be included in FWH 18.05

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Using C# (and .NET) from FWH

Posted: Fri Jun 29, 2018 10:58 AM

Aha, Closer to my arduino then :wink:

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1068
Joined: Wed Nov 09, 2005 02:17 AM

Re: Using C# (and .NET) from FWH

Posted: Thu Jul 19, 2018 02:14 PM

AntΓ΄nio,
Is it not ready yet ?
I thought would be included in FWH 18.05 :(

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
BelΓ©m-Pa-Brazil
Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using C# (and .NET) from FWH

Posted: Fri Jul 20, 2018 05:58 AM

Vilian,

Class TDotNet is already included in FWH 18.05 :-)

Please go to FWH\samples and do:

buildh.bat dotnet

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 140
Joined: Tue Oct 11, 2005 02:36 AM

Re: Using C# (and .NET) from FWH

Posted: Fri Jul 20, 2018 06:52 PM

Hello, friends

is it possible to use the FAST-REPORT.NET in this case?

I'm hanging on

Jackson Douglas C. Brito

Boa Vista - RR - Brasil

FWH 12.09 Last Build

xHarbour Free

UESTUDIO

SQLRDD
Posts: 6763
Joined: Wed Feb 15, 2012 08:25 PM

Re: Using C# (and .NET) from FWH

Posted: Fri Aug 03, 2018 08:07 PM
miragerr wrote:Hello, friends

is it possible to use the FAST-REPORT.NET in this case?

I'm hanging on

Please
Send me or put a sample of how you are using the DLL now
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la nociΓ³n del tiempo

El secreto de la felicidad no estΓ‘ en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 6
Joined: Wed Jun 05, 2019 02:24 PM

Re: Using C# (and .NET) from FWH

Posted: Mon Jun 17, 2019 12:06 PM
Hello!

It would be nice to use a .NET Dll with Fivewin and I tried the sample, but nothing happend, literally nothing. So I created my own Dll and changed the sample dotnet.prg to this:
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

Β  Β local oNet

Β  Β oNet := TDotNet():New()
Β  Β  ? IIF(oNet != nil, "Net yes!", "Net no :(")
Β  Β  XBrowse(__objGetValueList(oNet))
Β  Β  
Β  Β  oNet:Execute("SimpleDllFramework.dll", "SimpleDllFramework.Class1", "GetNumber", 2)
Β  Β  ? oNet:GetNetError()
Β  Β  ? oNet:GetReturnValue()
Β  Β 
Β  Β oNet:End()
Β  Β 
return nil


Code (fw): Select all Collapse
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
?FiveWin for xHarbour 19.03 - Mar. 2019 Β  Β  Β  Β  Β xHarbour development power β”‚β–„
?(c) FiveTech 1993-2019 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 β”‚β–ˆ
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜?
Β  β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€?
Compiling...
xHarbour 1.2.3 Intl. (SimpLex) (Build 20190603)
Copyright 1999-2018, http://www.xharbour.org <!-- m --><a class="postlink" href="http://www.harbour-project.org/">http://www.harbour-project.org/</a><!-- m -->
Compiling 'dotnet.prg' and generating preprocessed output to 'dotnet.ppo'...
Generating C source output to 'dotnet.c'...
Done.
Lines 27, Functions/Procedures 1, pCodes 69
Embarcadero C++ 7.30 for Win32 Copyright (c) 1993-2017 Embarcadero Technologies,
Β Inc.
dotnet.c:
Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, In
c.
* Application successfully built *


The sample doesn't show me either the messages or the XBrowse.
What went wrong?
I appreciate every hint I could get here :-)
Thanks in advance.

The simplest Dll I could imagine :-)

Code (fw): Select all Collapse
namespace SimpleDllFramework
{
Β  Β  public class Class1
Β  Β  {
Β  Β  Β  public static int GetNumber(int input = 1)
Β  Β  Β  {
Β  Β  Β  Β  Β return input * 10;
Β  Β  Β  }
Β  Β }
}

Compiled with .NET Framework 4 (first with 4.6.1), Core 2.2 and Standard 2 but nothing worked.

Sincerely

Continue the discussion