On 18 Oct 2013, at 20:38, Kyle Sluder k...@ksluder.com wrote:
CFBundleGetFunctionPointerForName just calls dlsym.
Sure. NSLog also eventually calls syslog. I still wouldn’t drop down to syslog
for most Cocoa logging needs.
CFBundleGetFunctionPointerForName takes a CFStringRef and if you’re
On 19 Oct 2013, at 01:17, Shane Stanley sstan...@myriad-com.com.au wrote:
On 19 Oct 2013, at 3:15 AM, Uli Kusterer witness.of.teacht...@gmx.net wrote:
this is what you'd do if you wanted to make e.g. CoreFoundation APIs
accessible to a scripting language
That's along the lines of what I
Le 19 oct. 2013 à 15:01, Uli Kusterer witness.of.teacht...@gmx.net a écrit :
On 19 Oct 2013, at 01:17, Shane Stanley sstan...@myriad-com.com.au wrote:
On 19 Oct 2013, at 3:15 AM, Uli Kusterer witness.of.teacht...@gmx.net
wrote:
this is what you'd do if you wanted to make e.g.
libclang is more than that.
Xcode code highlighting and code indexing is based on lib clang, as well as
delta compilation. (and I have a remote plan of cloning Xcode for GNUstep)
Also, there was a friend of mine that created a translator that converts code
from a new language to C, and I
On Oct 17, 2013, at 8:49 PM, Charles Srstka cocoa...@charlessoft.com wrote:
You shouldn't rely on dlsym() working in production code. If the binary is
stripped (as it is by default for release builds, I believe), it won't work.
You could work around that by exporting the symbol, e.g. by
On Oct 18, 2013, at 4:48 AM, Shane Stanley sstan...@myriad-com.com.au wrote:
is there any way to build a call to a C function on the fly? I mean something
like pass a string to a method, and have it call the function of that name?
Short: No. Long: Maybe.
1) You can put a function in a
On 2013 Oct 18,, at 04:48, Shane Stanley sstan...@myriad-com.com.au
wrote:
is there any way to build a call to a C function on the fly? I mean
something like pass a string to a method, and have it call the
function of that name?
This at least used to be shown in the Objective-C 2.0 Runtime
On Oct 18, 2013, at 6:15 AM, Dmitry Markman dmark...@me.com wrote:
I don't thinks strip remove info used by dynamic linker
Thus dlsym should work
As long as symbol is external (not with hidden visibility) dlsym is able to
find the symbol
(stripped or not)
Not in my testing:
#import
On Oct 18, 2013, at 6:15 AM, Dmitry Markman dmark...@me.com wrote:
I don't thinks strip remove info used by dynamic linker
Thus dlsym should work
As long as symbol is external (not with hidden visibility) dlsym is able to
find the symbol
(stripped or not)
Trying to set the symbol to
On Oct 18, 2013, at 6:15 PM, Uli Kusterer witness.of.teacht...@gmx.net wrote:
On Oct 18, 2013, at 4:48 AM, Shane Stanley sstan...@myriad-com.com.au wrote:
is there any way to build a call to a C function on the fly? I mean
something like pass a string to a method, and have it call the function
On Fri, Oct 18, 2013, at 10:39 AM, Uli Kusterer wrote:
Oh, one more thing: Instead of dlsym(), you can also use
CFBundleGetFunctionPointerForName() and its cohorts might also be useful
for this if you want to go a bit more high-level. But even then, it needs
to be an exported symbol in a
On 19 Oct 2013, at 3:15 AM, Uli Kusterer witness.of.teacht...@gmx.net wrote:
this is what you'd do if you wanted to make e.g. CoreFoundation APIs
accessible to a scripting language
That's along the lines of what I had in mind, although in this case for basic
things like the trig functions in
Try add this line:
extern void foo(void);
Sent from my iPhone
On 2013年10月19日, at 1:21, Charles Srstka cocoa...@charlessoft.com wrote:
On Oct 18, 2013, at 6:15 AM, Dmitry Markman dmark...@me.com wrote:
I don't thinks strip remove info used by dynamic linker
Thus dlsym should work
As
On Oct 18, 2013, at 6:42 PM, ChanMaxthon xcvi...@me.com wrote:
Try add this line:
extern void foo(void);
Already did; it doesn't work. See my follow-up post.
Charles
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post
I think I know why it did not work: strip command can remove debug symbols, or
unused functions as well.
Sent from my iPhone
On 2013年10月19日, at 7:53, Charles Srstka cocoa...@charlessoft.com wrote:
On Oct 18, 2013, at 6:42 PM, ChanMaxthon xcvi...@me.com wrote:
Try add this line:
extern
On Oct 18, 2013, at 7:30 PM, ChanMaxthon xcvi...@me.com wrote:
I think I know why it did not work: strip command can remove debug symbols,
or unused functions as well.
Yep.
Charles
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do
is there any way to build a call to a C function on the fly? I mean something
like pass a string to a method, and have it call the function of that name?
--
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/
On Oct 17, 2013, at 9:48 PM, Shane Stanley sstan...@myriad-com.com.au wrote:
is there any way to build a call to a C function on the fly? I mean something
like pass a string to a method, and have it call the function of that name?
No. That's an Objective-C feature that's not present in
You actually can, by using dlsym(3) to resolve the symbol, cast it to the
appropriate function pointer and call it.
For example:
int (*myfunc)(int, int) = dlsym(RTLD_DEFAULT, myfunc_name);
if (myfunc)
printf(“%d”, myfunc(2, 3));
else
fprintf(stderr, “error: cannot resolve symbol: %s”,
On Oct 17, 2013, at 10:40 PM, Maxthon Chan xcvi...@me.com wrote:
You actually can, by using dlsym(3) to resolve the symbol, cast it to the
appropriate function pointer and call it.
For example:
int (*myfunc)(int, int) = dlsym(RTLD_DEFAULT, myfunc_name);
if (myfunc)
printf(“%d”,
You can certainly move everything into a library, also you can prevent
executables from being stripped in Xcode.
Sent from my iPhone
On 2013年10月18日, at 11:54, Charles Srstka cocoa...@charlessoft.com wrote:
Loadable bundles and libraries don't get stripped. Executables, since they
don't
My original reply was too long for Cocoa Dev; then I lost it.
So this is another (small draft)...
It appears I'll be working with blocks, keeping the data/functioning local
to the stack copying data out to the GUI:
typedef sat_t (^MyBlock)();
// C - function:
int addFoot(int k) {
Environment: iOS SDK 4.2+
Xcode 3.2.5
Desired design:
1) Multiple NSThreads (via NSOperation?) running NSObjects in parallel:
processing the same C-functions (with different data) in real time till
conclusion (or cancelled).
2) These C-functions are located in a common *.c file (or two
In my projects, I tend to define methods which need access to member
variables as class methods, and related functions, which do not need
direct access to any internal object data, as C functions, like the
simple example below.
@implementation FunctionTestAppController
+ (id) sharedController
On Feb 15, 2009, at 10:32 AM, Martin Redington wrote:
In my projects, I tend to define methods which need access to member
variables as class methods, and related functions, which do not need
direct access to any internal object data, as C functions, like the
simple example below
variables as class methods, and related functions, which do not need
direct access to any internal object data, as C functions, like the
simple example below.
@implementation FunctionTestAppController
+ (id) sharedController
{
return [NSApp delegate];
}
- (BOOL) someMethod
On Feb 15, 2009, at 1:32 PM, Martin Redington wrote:
In my projects, I tend to define methods which need access to member
variables as class methods, and related functions, which do not need
direct access to any internal object data, as C functions, like the
simple example below
on, I have a need to write a code
generator that will wrap certain kinds of C functions as Objective C
messages on an Objective C proxy. Because I don't ultimately control
the input, the parameters on the C functions may be poorly named. I'm
looking for advice on how one might make useful object
definition that I showed was actually just a
SOAP service definition. What my proxy object will be calling are
about three or four different C functions to make the SOAP call,
hiding that complexity from the programmer. (I could just use C++ and
have this code generated for me automatically
On Nov 20, 2008, at 6:58 AM, Austin Ziegler wrote:
result = [calc addDoubleA:a withDoubleB:b]; // #1
Why not -addDouble:withDouble: ?
That is, why are you promoting the argument names into the method
signature? Especially since you're aware that the names are (most
often) useless.
On Nov 20, 2008, at 10:54 AM, Alexander Spohr wrote:
I’d go for #1.
If you have an error in status, throw an exception.
In this case, an exception might actually be OK, given that the
library is in isolation.
However, it goes against the design patterns of Cocoa and if the code
is ever
On Thu, Nov 20, 2008 at 12:27 AM, Austin Ziegler [EMAIL PROTECTED] wrote:
For a project that I'm working on, I have a need to write a code
generator that will wrap certain kinds of C functions as Objective C
messages on an Objective C proxy. Because I don't ultimately control
the input
On Thu, Nov 20, 2008 at 12:15 PM, Michael Ash [EMAIL PROTECTED] wrote:
Please excuse a foolish question, but Why wrap this in Objective-C
at all? Looks like the resulting ObjC code is essentially the same,
except uglier, slower, and harder to use. Why not just keep the C and
use it
On Nov 19, 2008, at 9:27 PM, Austin Ziegler wrote:
For a project that I'm working on, I have a need to write a code
generator that will wrap certain kinds of C functions as Objective C
messages on an Objective C proxy. Because I don't ultimately control
the input, the parameters on the C
On Thu, Nov 20, 2008 at 1:23 PM, Jonathon Kuo
[EMAIL PROTECTED] wrote:
Just my 2 cents, but it seems an abuse to turn functions into objects.
Functions don't retain state; objects do. Objective C very gracefully allows
objects to call C functions. If you're doing something like [calc
wrote:
For a project that I'm working on, I have a need to write a code
generator that will wrap certain kinds of C functions as Objective C
messages on an Objective C proxy. Because I don't ultimately control
the input, the parameters on the C functions may be poorly named. I'm
looking for advice
On Nov 20, 2008, at 2:07 PM, Shawn Erickson wrote:
On Thu, Nov 20, 2008 at 1:23 PM, Jonathon Kuo
[EMAIL PROTECTED] wrote:
Just my 2 cents, but it seems an abuse to turn functions into
objects.
Functions don't retain state; objects do. Objective C very
gracefully allows
objects to call C
. Objective C very
gracefully allows
objects to call C functions. If you're doing something like [calc
addDoubleA:a withDoubleB:b], you've got a function masquerading as
an
object, which I think misses the entire point of OOP.
It is common, if not appropriate, to have utility classes (often ones
into
objects.
Functions don't retain state; objects do. Objective C very
gracefully allows
objects to call C functions. If you're doing something like [calc
addDoubleA:a withDoubleB:b], you've got a function masquerading
as an
object, which I think misses the entire point of OOP.
It is common
, but it seems an abuse to turn functions into
objects.
Functions don't retain state; objects do. Objective C very
gracefully allows
objects to call C functions. If you're doing something like [calc
addDoubleA:a withDoubleB:b], you've got a function masquerading
as an
object, which I think
, Jonathon Kuo
[EMAIL PROTECTED] wrote:
Just my 2 cents, but it seems an abuse to turn functions into
objects.
Functions don't retain state; objects do. Objective C very
gracefully allows
objects to call C functions. If you're doing something like [calc
addDoubleA:a withDoubleB:b], you've got
On Thu, Nov 20, 2008 at 6:09 PM, Ken Tozier [EMAIL PROTECTED]
wrote:
Just out of curiosity, why do you need to send such common math
operations to a soap request? Wouldn't it be easier to do simple stuff
like calculations in your Soap class and only make requests for the
unique services the
For a project that I'm working on, I have a need to write a code
generator that will wrap certain kinds of C functions as Objective C
messages on an Objective C proxy. Because I don't ultimately control
the input, the parameters on the C functions may be poorly named. I'm
looking for advice on how
On Fri, Mar 28, 2008 at 9:14 AM, Trygve Inda [EMAIL PROTECTED] wrote:
I have a Cocoa object with .m and .h files and need to include in this a
series of about 30 C functions which all all in their own .c file. Is it
possible to give functions in the .c file access to the .m files instance
44 matches
Mail list logo