Forums

I have installed Cobra on Debian Linux !

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

I have installed Cobra on Debian Linux !

Postby Achletomeniak » Mon Jun 05, 2017 6:08 am

Hi ,

i have installed Cobra on debian Linux. With the Mono package.

have the file gtk example.

gtk.cobra

when i make : cobra gtk.cobra

a window with two buttons is seen. it works.

One question. there is a gtk.exe file created. why

i am on Linux. how about a executable there ?

WBR
Ach
Achletomeniak
 

Re: I have installed Cobra on Debian Linux !

Postby Charles » Mon Jun 05, 2017 12:00 pm

Cobra compiles to .NET byte code which is stored in .exe files for programs and .dll files for libraries. The ability to say "cobra gtk.cobra" is just a convenience for "cobra -c gtk.cobra; mono gtx.exe"
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: I have installed Cobra on Debian Linux !

Postby Achletomeniak » Mon Jun 05, 2017 12:20 pm

Thank you for that answer ,

does that mean the compiled .exe should be run on a windows system ?

is .net recommended or can i only use Novell Mono on the windows machine ?

WBR
Ach
Achletomeniak
 

Re: I have installed Cobra on Debian Linux !

Postby Charles » Mon Jun 05, 2017 1:23 pm

Yes the .exe and .dll's should work just fine on any platform, including Windows, and regardless of which platform they were created on. Years ago I created, on Mac, an OpenTK program that rotated a cube on screen with 3D acceleration. I then took it over to Windows and it ran there without recompiling.

There are exceptions to this however mostly having to do with libraries that may not be available on one platform, or needing to rebuild simply to point to the correct libraries.

On Windows, I recommend .NET because it runs substantially faster than Mono, but it's not a requirement. Also there is a GTK# installer for Windows. I have a GTK# app that runs on both Mac and Windows. I do build it separately. Here are the build scripts:
Code: Select all
$  cat bin/_common
cd ..

$  cat bin/build
#!/bin/bash

# change to the directory of the script
cd "`dirname "$0"`"

source _common

mkdir -p build

cd source
cobra -c -d -color -timeit \
   -copy-core \
   -out:../build/TimeTracker.exe \
   -pkg:gtk-sharp-2.0 \
   "$@" \
   lib/ObjectLister.cobra \
   models/Project.cobra \
   models/FileModel.cobra \
   models/Invoice.cobra \
   models/Time.cobra \
   models/Total.cobra \
   gtk/TimeTracker.cobra \
   gtk/Extensions.cobra \
   gtk/TextEditor.cobra \
   gtk/AppWide.cobra

$  cat bin/build.cmd
@rem  build on Windows

@rem  must install gtk-sharp-2.12.42.msi or similar
@rem  found in my Dropbox\Windows\Packages
@rem  also found at http://www.mono-project.com/download/ in "GTK# for Windows" section

if not exist "build-win\" mkdir build-win

cd source
call cobra -c -d -color -timeit ^
-copy-core ^
-out:../build-win/TimeTracker.exe ^
-native-compiler-arg:"/platform:x86" ^
-target:winexe ^
-lib:"C:\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0" ^
-ref:glib-sharp.dll ^
-ref:gdk-sharp.dll ^
-ref:gtk-sharp.dll ^
-ref:atk-sharp.dll ^
-ref:pango-sharp.dll ^
%* ^
lib/ObjectLister.cobra ^
models/Project.cobra ^
models/FileModel.cobra ^
models/Invoice.cobra ^
models/Time.cobra ^
models/Total.cobra ^
gtk/TimeTracker.cobra ^
gtk/Extensions.cobra ^
gtk/TextEditor.cobra ^
gtk/AppWide.cobra

cd ..

HTH!
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 32 guests

cron