So, it appeared as though it's possible to convert .Net classes to work with a COM interface. There was an example posted for PB and BCX. I converted for use with Freebasic.
' Modified for Freebasic by phishguy
'----------------------------------------------------------------------------
' Calling .NET classes from BCX
'----------------------------------------------------------------------------
'First, install the latest .Net Framework from Microsoft then
'run C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm system.dll
'----------------------------------------------------------------------------
'http://www.jose.it-berater.org/smfforum/index.php?topic=3053.msg9447#msg9447
'----------------------------------------------------------------------------
#Define unicode
#include once "disphelper\disphelper.bi"
DIM shared owc AS IDispatch Ptr
DIM vAddress as string
DIM vFileName as string
dhInitialize(TRUE)
dhToggleExceptions(TRUE)
dhCreateObject("System.Net.WebClient",null,@owc)
vAddress = "http://www.bcxgurus.com/bcxlogo.jpg"
vFileName = CURDIR + "\bcxlogo.jpg"
dhcallmethod(owc,".Downloadfile (%s,%s)",vAddress,vFilename)
SAFE_RELEASE(owc)
dhUninitialize(TRUE)
sleep
I suppose it is not possible to use Mono this way. Disphelper is a Windows only library. It would be nice to design GUIs etc. with Mono on Linux.
I'll try when I'm on Windows though. Thank you.
joseywales72 wrote:I suppose it is not possible to use Mono this way. Disphelper is a Windows only library. It would be nice to design GUIs etc. with Mono on Linux.
I'll try when I'm on Windows though. Thank you.
So what you do is embed the Mono interpreter and then:
- call Mono routines from FB;
- call FB routines from Mono.
You'll need some C header files to get the embedding done (I don't think FB comes with Mono header files).
Or you can try cilc.
cilc is the Mono CIL-to-C binding generator. It takes a CIL assembly as input and generates a directory of C sources which, when compiled, provide a C interface to the classes contained within that assembly by means of a shared object library.
Generated sources make use of the Mono embedding API. Thus a complete Mono development environment must be available on the development system and a complete Mono runtime environment must be available on target systems.
You'd need a C compiler to produce the library (not a problem on Linux). The routines inside the library should be callable from FreeBASIC.