# Errors in include "CFURL.h"

**URL:** <https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830>\
**Category:** Ruby\
**Created:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830 "2006-08-15T14:19:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/1 "2006-08-15T14:19:36Z")

</div>

now, my skeleton is working (thanks to ) i want to add Carbon function  
into my c file.

i’ve only added :

#include “/Developer/Headers/FlatCarbon/CFURL.h”

and :

CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,  
(CFStringRef)\_fullAliasPath, kCFURLPOSIXPathStyle, NO);

into my “RAliasFile.c”

and i get number of errors within “CFURL.h” and related, i suppose this  
is a syntax prob then, i have to convert “CFURL.h” to be C-Ruby  
compatible ???

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/2 "2006-08-15T14:19:43Z")

</div>

On 14 août 06, at 08:15, Une bévue wrote:

> #include “/Developer/Headers/FlatCarbon/CFURL.h”

CF = CoreFoundation != Carbon.

You simply need #include \<CFUrl.h\> and then instruct gcc to look for  
it in  
/System/Library/Frameworks/CoreFoundation.framework/Headers/

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/3 "2006-08-15T14:19:43Z")

</div>

Luc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> CF = CoreFoundation != Carbon.
> 
> You simply need #include \<CFUrl.h\> and then instruct gcc to look for  
> it in  
> /System/Library/Frameworks/CoreFoundation.framework/Headers/

oK thanxs, i’ve done that :

$CFLAGS \<\< " -I  
/System/Library/Frameworks/CoreFoundation.framework/Headers "

in my “extconf.rb” where mkmf is included.

however i get (at run time) :  
dyld: NSLinkModule() error  
dyld: Symbol not found: \_CFURLCreateWithFileSystemPath  
Referenced from: ./osx/ralias/raliasfile.bundle  
Expected in: flat namespace

does i need to change another flag, for example :  
LDFLAGS ??

should have :  
-read\_only\_relocs suppress

giving for the whole :

-flat\_namespace -undefined suppress -read\_only\_relocs suppress ???

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/4 "2006-08-15T14:19:53Z")

</div>

On Aug 14, 2006, at 5:15 AM, Une bévue wrote:

> Referenced from: ./osx/ralias/raliasfile.bundle  
> -flat\_namespace -undefined suppress -read\_only\_relocs suppress ???  
> Try linking against the framework using the -framework flag.

$LDFLAGS \<\< " -framework CoreFoundation".

– Daniel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/5 "2006-08-15T14:19:43Z")

</div>

Une bévue [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> does i need to change another flag, for example :  
> LDFLAGS ??

i’ve allready try :  
LDFLAGS=“-Wl,-read\_only\_relocs,warning”

in my “extconf.b” raising the same prob.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/6 "2006-08-15T14:19:54Z")

</div>

Daniel H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Try linking against the framework using the -framework flag.
> 
> $LDFLAGS \<\< " -framework CoreFoundation".

fine thanks, it’s ok now for the links, however i get a bus error at  
runtime :

/Users/yvon/work/Ruby/Native/C/raliasfile\_test.rb:8: [BUG] Bus Error  
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.7.0]

From C =\> alias\_path :  
/Users/yvon/work/Ruby/Native/C/doc/Introduction\_ANSI\_C\_html

the line 8 of raliasfile\_test.rb being simply :

a=RAliasFile.new(“/Users/yvon/work/Ruby/Native/C/doc/Introduction\_ANSI\_C  
\_html”)  
(just after “require ‘osx/ralias/raliasfile’”)

and on the C side :

VALUE m\_raliasfile\_init(VALUE self, VALUE alias\_path)  
{  
printf(“From C =\> alias\_path : %s\n”, StringValuePtr(alias\_path));  
rb\_iv\_set(self, “@alias\_path”, alias\_path);  
Boolean NO=(Boolean)Qfalse;  
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,  
(CFStringRef)alias\_path, 0, NO);  
if (url != NULL) {  
printf(“From C =\> url != NULL\n”);  
}  
return self;  
}

from the printf(…) i know the error is certaiinly due to this line :

CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,  
(CFStringRef)alias\_path, 0, NO);

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/7 "2006-08-15T14:19:55Z")

</div>

On Aug 14, 2006, at 10:42 AM, Daniel H. wrote:

> What is the output from the printf statement?

Oh wait, never-mind, it is there.

– Daniel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/8 "2006-08-15T14:19:55Z")

</div>

On Aug 14, 2006, at 10:20 AM, Une bévue wrote:

> from the printf(…) i know the error is certaiinly due to this line :
> 
> CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,  
> (CFStringRef)alias\_path, 0, NO);

What is the output from the printf statement?

Try (CFStringRef)StringValuePtr(alias\_path) or CFSTR(StringValuePtr  
(alias\_path)).

– Daniel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/errors-in-include-cfurl-h/64830/9 "2006-08-15T14:19:57Z")

</div>

Daniel H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> What is the output from the printf statement?

From C =\> alias\_path :  
/Users/yvon/work/Ruby/Native/C/doc/Introduction\_ANSI\_C\_html

> Try (CFStringRef)StringValuePtr(alias\_path)

still a seg fault :  
“-L/opt/local/lib -framework CoreFoundation\ncreating Makefile\n”  
“gcc -fno-common -O -pipe -I/opt/local/include -fno-common -pipe  
-fno-common -I  
/System/Library/Frameworks/CoreFoundation.framework/Headers -I.  
-I/opt/local/lib/ruby/1.8/powerpc-darwin8.7.0  
-I/opt/local/lib/ruby/1.8/powerpc-darwin8.7.0 -I. -O -pipe  
-I/opt/local/include -c RAliasFile.c\ncc -dynamic -bundle -undefined  
suppress -flat\_namespace -L/opt/local/lib -framework CoreFoundation  
-L"/opt/local/lib" -o raliasfile.bundle RAliasFile.o -lruby  
-lpthread -ldl -lobjc \n”  
/Users/yvon/work/Ruby/Native/C/osx/ralias/compil.rb:31: [BUG]  
Segmentation fault  
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.7.0]

From C =\> alias\_path :  
/Users/yvon/work/Ruby/Native/C/doc/Introduction\_ANSI\_C\_html

> or CFSTR(StringValuePtr(alias\_path)).

and here i get a parse error (???) :

RAliasFile.c:29: error: parse error before ‘rb\_string\_value\_ptr’

the line being :

CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,  
CFSTR(StringValuePtr(alias\_path)), 0, NO);
