Skip to content

The cblock Macro Does Not Work #31

@sorin-ionescu

Description

@sorin-ionescu

It claims to not be able to find signature_for_identifier.

It would be helpful if blocks would just work like in MacRuby. I do not wish to distinguish between Nu blocks and Objective-C blocks.

#!/usr/bin/env nush

(load "nu")
(load "cblocks") 

(set myList '("one" "two" "three"))
(set myArray (myList array))

(puts "each: works")
(myList each:
    (do (obj)
        (puts obj)))

(puts "cBlockWithNuBlock: works")
(myArray enumerateObjectsUsingBlock:
    (NuBridgedBlock cBlockWithNuBlock:
        (do (obj idx stop)
            (puts obj))
        signature:"v@I^?")) 

(puts "cblock: fails")
(myArray enumerateObjectsUsingBlock:
    (cblock void ((id) obj (unsigned long) idx (BOOL*) stop)
        (puts obj)))
each: works
one
two
three
cBlockWithNuBlock: works
one
two
three
cblock: fails
Nu uncaught exception: NuCantFindBridgedFunction: dlsym(RTLD_DEFAULT, signature_for_identifier): symbol not found
If you are using a release build, try rebuilding with the KEEP_PRIVATE_EXTERNS variable set.
In Xcode, check the 'Preserve Private External Symbols' checkbox.

  from <TopLevel>:-1: in NuBridgedFunction
  from <TopLevel>:-1: in (NuBridgedFunction functionWithName: "signature_for_identifier" signature: "@@@")
  from <TopLevel>:-1: in ((NuBridgedFunction functionWithName: "signature_for_identifier" signature: "@@@") identifier (NuSymbolTable sharedSymbolTable))
  from <TopLevel>:-1: in g1804289383__get_type_signature
  from <TopLevel>:-1: in set
  from <TopLevel>:-1: in progn
  from <TopLevel>:-1: in bridgedblock
  from <TopLevel>:-1: in (bridgedblock (obj idx stop) (puts obj) ())
  from ./test.nu:23: in cblock
  from ./test.nu:22: in myArray
  from /Library/Frameworks/Nu.framework/Resources/help.nu:136: in progn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions