Page 1 of 1

Using .NET library

PostPosted: Mon Mar 14, 2016 11:43 am
by Marc Vanzegbroeck
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

Re: Using .NET library

PostPosted: Mon Mar 14, 2016 3:07 pm
by Antonio Linares

Re: Using .NET library

PostPosted: Mon Mar 14, 2016 3:42 pm
by Antonio Linares

Re: Using .NET library

PostPosted: Mon Mar 14, 2016 7:47 pm
by Marc Vanzegbroeck
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.

Re: Using .NET library

PostPosted: Mon Mar 14, 2016 8:10 pm
by Antonio Linares
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.

Re: Using .NET library

PostPosted: Tue Mar 15, 2016 8:12 am
by Marc Vanzegbroeck
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.

Re: Using .NET library

PostPosted: Tue Mar 15, 2016 10:24 am
by Antonio Linares
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
 

Re: Using .NET library

PostPosted: Tue Mar 15, 2016 10:26 am
by Antonio Linares
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

Re: Using .NET library

PostPosted: Tue Mar 15, 2016 10:32 am
by Antonio Linares
In other words:

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

Re: Using .NET library

PostPosted: Sat Mar 19, 2016 10:51 am
by Marc Vanzegbroeck
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

Re: Using .NET library

PostPosted: Sat Mar 19, 2016 11:59 am
by Marc Vanzegbroeck
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

Re: Using .NET library

PostPosted: Sat Mar 19, 2016 4:36 pm
by Antonio Linares
very good :-)

Re: Using .NET library

PostPosted: Tue Apr 24, 2018 2:20 am
by vilian
Antônio,

Do you know if is possible to integrate FWH with this https://www.signfiles.com/signature-library/ ?
Could you help us ?

Re: Using .NET library

PostPosted: Tue Apr 24, 2018 7:14 am
by Antonio Linares
Vilian,

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

That may be much easier :-)

Re: Using .NET library

PostPosted: Tue Apr 24, 2018 11:37 am
by vilian
Ok,

I will ask them.