Pointer on island

Is there a way to use a plain pointer as method result on windows?
I’m try to use Opengl on windows. I have there a funtion to return function pointers for exports in opengl

method GetPlainPtr: ^Void;

or what do you mean?

I think something like these:

namespace Test;

interface
uses rtl;

method callMyProc(const i : Integer);

implementation

type
[CallingConvention(CallingConvention.Stdcall)]
Tmyproc = procedure(const i : Integer);

method callMyProc(const i : Integer);
var h : HMODULE;
lp : Tmyproc;
begin
h := HMODULE(0); // Only for Test the Code here
// lp := GetProcAddress(h, ‘myproc’); // Will not work
lp := Tmyproc(GetProcAddress(h, ‘myproc’)); // will work
lp(i);

end;

end.

without the need to Cast every call to getProcAdress to a Type

Not aur enow that would work. GetProcAddress is defined to return a FARPROC, which in turn is defined as

rtl.FARPROC = public block(): Int32;

i.e. a parameterless method that returns an integer; since GetProcAddress can return the dress of any kind of method, but Oxygene is a strongly typed language, you’ll need some kind of cast to let the compiler know what the actual method looks like.

Even though GetProcAddress is “special” in that way, the compiler also can’t just treat any kind of method pointer as compatible, as that wold reach all kind of havoc when they don’t match.

A cast is the (proper) way to tell the compiler “i know you think this is a specific type, but i know better, so let me override that”.

ok, i understand these. Is there a way to import opengl.h ?
if not i will write a tool to convert my source to oxygene syntax.

Yes, via HeaderImporter. Carlo knows the AI to that better, for Island, so i’ll have to defer to him chiming in on this on Monday (we really need to get some docs written ;).

Might also be that we can include OpenGL.h by default in a future update.

Thanks, so i go now in weekend. You should also😀

:wink: done

1 Like

where did u shoot this pic? :open_mouth: really beatiful!

thanx! a little east of Parasasa beach, around here:
https://goo.gl/maps/4NQ6KDRaLQR2

hmm. apparently google maps links don’t preserve the exact location, that link but goes by the street name it seems. scroll about 2km to the east, thereaboutish:

1 Like

Saw it, really cool :astonished: Are you also living their near the beach or more far away?

ca 3 minutes walk for me to have me feet in the sand :wink: different one that the one from the link though, i live in Blue Bay, about 5km or so west from there.

ah cool :slight_smile:

Yeah, sometimes I wish to live near the beach as well :slight_smile:

guess how many times i have actually been in the ocean this year? i think it was three times :wink:

but yeah, don’t get me wrong, this is an amazing place to live, we’re very lucky.

1 Like