Using .NET library

Post Reply
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Using .NET library

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Using .NET library

Post 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.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Using .NET library

Post 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.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post 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


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

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: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post by Antonio Linares »

Marc,

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

Code: Select all | Expand

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: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Using .NET library

Post 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
Regards,
Marc

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

Re: Using .NET library

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post by Antonio Linares »

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
vilian
Posts: 987
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Using .NET library

Post 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 ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

Re: Using .NET library

Post by Antonio Linares »

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
vilian
Posts: 987
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Using .NET library

Post by vilian »

Ok,

I will ask them.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Post Reply