2 messages in net.java.dev.jna.users[jna-users] Calling Mac Carbon APIs w...
FromSent OnAttachments
Alan SnyderAug 21, 2008 3:04 pm 
Timothy WallAug 21, 2008 3:48 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] Calling Mac Carbon APIs with JNA.Actions...
From:Alan Snyder (ala@tidebreaksys.com)
Date:Aug 21, 2008 3:04:13 pm
List:net.java.dev.jna.users

I'd like to use JNA to call the Carbon APIs on the Mac. (OS X 10.3 and later).

I'm stuck on two items currently and would like some advice.

#1) What Native.loadLibrary() call is needed to get Carbon which (with my brief use of Mac) doesn't seem to have an equivalent of dll or so.

#2) The Win32 had lots of good utility classes, but I don't know if they are there on the Mac side. For example to call user32.dll in Win32 this seems to be the best way.

public interface GCP_User32 extends StdCallLibrary{

GCP_User32 INSTANCE = (GCP_User32)Native.loadLibrary("user32", GCP_User32.class);

/** Defines the x- and y-coordinates of a point. */ class POINT extends Structure { public int x, y; public POINT() { } public POINT(int x, int y) { this.x = x; this.y = y; } } boolean GetCursorPos(GCP_User32.POINT lpPoint);

}

What would be the equivalent for Carbon? Would the following work? Is "extends NativeLibrary" below correct or is there a Mac equivalent of win32's "StdCallLibrary"?

public interface GCP_Carbon extends NativeLibrary{

GCP_Carbon INSTANCE = (GCP_Carbon)Native.loadLibrary("user32", GCP_Carbon.class);

/** Defines the x- and y-coordinates of a point. */ class POINT extends Structure { public int x, y; public POINT() { } public POINT(int x, int y) { this.x = x; this.y = y; } } boolean GetMouse(GCP_Carbon.POINT mouseLoc);