2 messages in net.java.dev.jna.usersRe: [jna-users] How to define a Mac C...
FromSent OnAttachments
Alan SnyderJan 13, 2009 3:20 pm 
Timothy WallJan 13, 2009 4:11 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:Re: [jna-users] How to define a Mac Core Foundation constant in JNA Library interface?Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Jan 13, 2009 4:11:51 pm
List:net.java.dev.jna.users

NativeLibrary.getGlobalVariableAddress() is provided to look up globals, e.g.

Pointer p = NativeLibarary .getInstance ("CoreFoundation").getGlobalVariableAddress("kCFRunLoopDefaultMode");

You can then dereference the pointer as appropriate for the variable type.

On Jan 13, 2009, at 6:21 PM, Alan Snyder wrote:

A very specific question about Mac's OS X Foundation Library. Given the snippet of this header file in Apple's CoreFoundation library how would one define the constant:

CF_EXPORT const CFStringRef kCFRunLoopDefaultMode;

in a JNA Library interface?

Any comments appreciated.

Alan

P.S. I'll ask this question over at Rococoa too.

-----------------

/* CFRunLoop.h Copyright (c) 1998-2007, Apple Inc. All rights reserved. */

#if !defined(__COREFOUNDATION_CFRUNLOOP__) #define __COREFOUNDATION_CFRUNLOOP__ 1

#include <CoreFoundation/CFBase.h> #include <CoreFoundation/CFArray.h> #include <CoreFoundation/CFDate.h> #include <CoreFoundation/CFString.h> #if defined(__MACH__) #include <mach/port.h> #endif

CF_EXTERN_C_BEGIN

typedef struct __CFRunLoop * CFRunLoopRef; : : :

/* Reasons for CFRunLoopRunInMode() to Return */ enum { kCFRunLoopRunFinished = 1, kCFRunLoopRunStopped = 2, kCFRunLoopRunTimedOut = 3, kCFRunLoopRunHandledSource = 4 };

CF_EXPORT const CFStringRef kCFRunLoopDefaultMode; CF_EXPORT const CFStringRef kCFRunLoopCommonModes;