Using .NET library

Using .NET library

Postby Marc Vanzegbroeck » Mon Mar 14, 2016 11:43 am

Hi,

Is is possible to use a .NET library with FWH? Or is it better to create a seperate EXE-file compiled with the .NET library, and transfer the data with a text-file.
A want to use a .NET library file that generate drawings. My program give the correct data to create it.

Thanks
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Using .NET library

Postby Antonio Linares » Mon Mar 14, 2016 3:07 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby Antonio Linares » Mon Mar 14, 2016 3:42 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby Marc Vanzegbroeck » Mon Mar 14, 2016 7:47 pm

Antonio,

When I press the link https://bitbucket.org/fivetech/fivenet/wiki/Home

I get

You do not have access to the wiki.
Use the links at the top to get back.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Using .NET library

Postby Antonio Linares » Mon Mar 14, 2016 8:10 pm

Marc,

Please try it again, it should be ok now

FiveNet source code is very simple: We create a .NET DLL that we register and we manage from a Harbour application.

When we need some .NET value from the Harbour app, then we use a C DLL that access the code from the EXE.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby Marc Vanzegbroeck » Tue Mar 15, 2016 8:12 am

Antonio,

if I understand correctly, I need to create a .NET exe with my function to generate my drawings, and call a function from the harbour application.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Using .NET library

Postby Antonio Linares » Tue Mar 15, 2016 10:24 am

Marc,

A .NET DLL, and then use the DLL from the Harbour app

In FiveNet makefile you can see how the DLL is created from a C sharp file:

Code: Select all  Expand view

fivenet.dll : fivetech.cs
   c:\Windows\Microsoft.NET\Framework\v3.5\csc /out:samples\fivenet.dll /target:library source\cs\fivetech.cs
   c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm samples\fivenet.dll /tlb
 


Also, the DLL needs to be registered:

FiveNet\samples\register.bat
Code: Select all  Expand view
c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm fivenet.dll /tlb
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby Antonio Linares » Tue Mar 15, 2016 10:26 am

Marc,

From FiveNet/source/prg/fivenet.prg this init procedure creates an OLE (.NET) object:

Code: Select all  Expand view
init procedure FiveNet

   local bError

   if oFiveNet == nil
      try
         oFiveNet = win_oleCreateObject( "FiveTech.FiveNet" )
      catch bError
         wapi_MessageBox( 0, "Can't create object 'FiveTech.FiveNet'",;
                          "Please use register.bat", MB_ICONEXCLAMATION )
      end
   endif

return
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby Antonio Linares » Tue Mar 15, 2016 10:32 am

In other words:

Once the DLL is registered we can instantiate an OLE object to manage the DLL from the Harbour app
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby Marc Vanzegbroeck » Sat Mar 19, 2016 10:51 am

Antonio,

If I run go.bat, I get :
    C:\_vmsdata\FWH\Fivenet>go

    C:\_vmsdata\FWH\Fivenet>if not exist obj md obj

    C:\_vmsdata\FWH\Fivenet>c:\_vmsdata\FWH\bcc55\bin\make -ffivenet.mak
    MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
    c:\Windows\Microsoft.NET\Framework\v3.5\csc /out:samples\fivenet.dll /ta
    rget:library source\cs\fivetech.cs
    Microsoft (R) Visual C# 2008 Compiler versie 3.5.30729.5420
    voor Microsoft (R) .NET Framework versie 3.5
    Copyright (C) Microsoft Corporation. Alle rechten voorbehouden.

    c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm samples\fivenet.dll
    /tlb
    Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.5483
    Copyright (C) Microsoft Corporation 1998-2004. Alle rechten voorbehouden.

    Typen zijn geregistreerd
    Assembly is geëxporteerd naar C:\_vmsdata\FWH\Fivenet\samples\fivenet.tlb en de
    typebibliotheek is geregistreerd
    C:\_vmsdata\FWH\bcc55\bin\bcc32 -c source\c\ftsnet.c
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    source\c\ftsnet.c:
    C:\_vmsdata\FWH\bcc55\bin\ilink32 /Tpd C:\_vmsdata\FWH\bcc55\lib\c0d32.o
    bj ftsnet.obj, samples\ftsnet.dll,,C:\_vmsdata\FWH\bcc55\lib\cw32.lib C:\_vmsdat
    a\FWH\bcc55\import32.lib
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
    Kan C:\_vmsdata\FWH\Fivenet\samples\ftsnet.obj niet vinden
    Kan C:\_vmsdata\FWH\Fivenet\samples\ftsnet.tlb niet vinden

    C:\_vmsdata\FWH\Fivenet>

So everything looks fine, except the 2 last lines. He can't find ftsnet.obj, and ftsnet.tlb.

Is that an error, or is this normal, because in the MAK-file, I see
    ftsnet.dll : ftsnet.c
    $(BCDIR)\bin\bcc32 -c source\c\ftsnet.c
    $(BCDIR)\bin\ilink32 /Tpd $(BCDIR)\lib\c0d32.obj ftsnet.obj, samples\ftsnet.dll,,$(BCDIR)\lib\cw32.lib $(BCDIR)\import32.lib
    @del samples\ftsnet.i*
    @del samples\ftsnet.map
    @del samples\ftsnet.obj
    @del samples\ftsnet.tds
    @del samples\ftsnet.tlb
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Using .NET library

Postby Marc Vanzegbroeck » Sat Mar 19, 2016 11:59 am

Before i have tried it with an old version of xharbour and got an error.
Now I tested it with Harbour and BCC7, and it's working!!!

Thanks
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Using .NET library

Postby Antonio Linares » Sat Mar 19, 2016 4:36 pm

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby vilian » Tue Apr 24, 2018 2:20 am

Antônio,

Do you know if is possible to integrate FWH with this https://www.signfiles.com/signature-library/ ?
Could you help us ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Using .NET library

Postby Antonio Linares » Tue Apr 24, 2018 7:14 am

Vilian,

Why don't you contact them for a C compatible DLL version ?

That may be much easier :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42063
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using .NET library

Postby vilian » Tue Apr 24, 2018 11:37 am

Ok,

I will ask them.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 64 guests