Author Topic: First 64 bit Windows compilation  (Read 8697 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Re: First 64 bit Windows compilation
« Reply #15 on: November 24, 2011, 02:51:09 AM »
Hi Petr,

Simple DLL test with bstrings

Code: OxygenBasic
  1.  
  2.   '
  3.  $dll
  4.   $filename "t64.dll"
  5.   #include "..\..\inc\RTL64.inc"
  6.  
  7.  
  8.   print "t64.dll Loaded"
  9.  
  10.   function HelloA(string s) as string, export
  11.     return "HelloA "+s
  12.   end function
  13.  
  14.   function HelloW(wstring s) as wstring, export
  15.     return "HelloW "+s
  16.   end function
  17.  

Testing from Oxygen:

Code: OxygenBasic
  1.   $filename "TestHello64.exe"
  2.   #include "..\..\inc\RTL64.inc"
  3.  
  4.  
  5.   declare function HelloA lib "t64.dll" (string s) as string
  6.   declare function HelloW lib "t64.dll" (wstring s) as wstring
  7.  
  8.   print HelloA "World!"
  9.   print HelloW "World!"
  10.  
  11.  

I will add a DLLs folder to the /examples section

Charles

PS: compiled code here:
« Last Edit: November 24, 2011, 04:38:33 AM by Charles Pegge »

Petr Schreiber

  • Guest
Re: First 64 bit Windows compilation
« Reply #16 on: November 24, 2011, 11:46:48 AM »
Hi Charles,

I got this code in C# to wrap HelloW:
Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        [DllImport("t64.dll", EntryPoint = "HelloW")]
        [return: MarshalAs(UnmanagedType.TBStr)]
        public static extern string HelloW([MarshalAs(UnmanagedType.TBStr)] string sText);

        static void Main(string[] args)
        {
            Console.WriteLine(HelloW("Ciao Charles, this is great!"));
            
            Console.ReadKey();
        }
    }
}

It prints to my console
Quote
HelloW Ciao Charles, this is great!

which is ... correct! Tried even some Czech texts, worked perfectly...

Is there any preview release of 64bit-able oxygen available? I will be happy to continue with more complex tests... ;)


Petr
« Last Edit: November 24, 2011, 11:48:34 AM by Petr Schreiber »

Peter

  • Guest
Re: First 64 bit Windows compilation
« Reply #17 on: November 24, 2011, 12:06:35 PM »
to be honest, I would rather write with OxygenBasic.
C# is from another world without atmosphere.  :D
« Last Edit: November 24, 2011, 02:11:55 PM by peter »

Charles Pegge

  • Guest
Re: First 64 bit Windows compilation
« Reply #18 on: November 24, 2011, 01:50:40 PM »

Glad it works Petr, that is very reassuring.

I'm chasing a bug affecting negative floating point / integer conversions, which seems to be down at the opcode level. But I will post my latest now.

(Oxygen in-progress version from the website)

Charles

Charles Pegge

  • Guest
Re: First 64 bit Windows compilation
« Reply #19 on: November 24, 2011, 09:30:59 PM »
Fixed those bugs.

I'm working through some of Peter's demo programs with a 64 bit-compatible version of window.h. These are in the projects/GDIWindow folder

Charles

PS: Judging by the complexity of the C# protocol, they seem to be saying:
"DLLs are weird primitive entities and are not welcome here!"
« Last Edit: November 24, 2011, 09:51:55 PM by Charles Pegge »

Petr Schreiber

  • Guest
Re: First 64 bit Windows compilation
« Reply #20 on: November 24, 2011, 11:51:47 PM »
Quote
PS: Judging by the complexity of the C# protocol, they seem to be saying:
"DLLs are weird primitive entities and are not welcome here!"

Hehe, yes. On the other side, the .NET DLLs do not need any declares at all, you just add the .NET DLL as reference to project and it works out of the box (including code completion integration to the IDE).

Thanks again for your efforts on the 64bit side, I will continue testing this weekend :)


Petr

Charles Pegge

  • Guest
Re: First 64 bit Windows compilation
« Reply #21 on: November 26, 2011, 03:19:08 PM »

Embedding header information in the DLL is definitely worth thinking about. It could be put into a string constant and thus be accessible to IDES, and programs at runtime. No special DLL section required.

Charles

Petr Schreiber

  • Guest
Re: First 64 bit Windows compilation
« Reply #22 on: November 27, 2011, 10:50:43 AM »
Hi Charles,

seems good idea to me. But in such a case it would have to be header in specific language, or am I wrong? Or would it be some kind of general XML?

I was testing the Oxygen a bit this weekend. Interesting observation is that once I use:
Code: [Select]
#include "..\inc\rtl32.inc"
for example, then the F5 key from the SciTe does not execute anything, and just builds EXE.

I liked what I saw, only suggestions:
  • The error messages are very, very brief, sometimes I didn't know what's going on. For example when I had bad path for INC file it kept telling me "Error, problem with file". Maybe "Include file could not be located in" and then the presumed location would make the debugging easier. I was confused, so I headed to help file to seek help in the #include topic, where I found example code
Code: [Select]
#include "rtl32.inc", which didn't worked. I had to setup the path as
Code: [Select]
#include "..\inc\rtl32.inc"
    by experimenting
    • I would recommend to structure the documentation in more natural way. For example, the Keyword list only appears after pressing F1 from the IDE, but I cannot find a topic for it later
    • Some of the topics are really brief, for example the one for COM keyword. Most of them are okay for people already programming, but for newcomers to coding it can be a bit brief.
    I understand the points 2 and 3 are present due to fact Oxygen is in active developement.

    What I really love on other side is instant compilation and overall feel of the language. I will repeat myself, but you do great job Charles :)


Petr

Charles Pegge

  • Guest
Re: First 64 bit Windows compilation
« Reply #23 on: November 27, 2011, 01:27:56 PM »
Hi Petr,

Many thanks for your observations.

The options available for SCITE compile / run are limited. The best strategy is to do all the debugging with a direct F5 run, then add the run-time library for independent compilation.

Using SCITE is a temporary measure, and the plan is to create a customised IDE based on Opengl, that can also be deployed in Linux.

The manual needs a lot more material including linked  in examples. CHM help is not the optimal solution. We need a system that ultimately plugs straight into the IDE.

Error messages could also link directly into the manual for fuller description.

Charles

« Last Edit: November 27, 2011, 01:45:45 PM by Charles Pegge »