Coder Social home page Coder Social logo

Comments (7)

andlabs avatar andlabs commented on July 24, 2024

A local change I just made (implementing the handled return of AreaHandler.Mouse()) breaks darwin/386 and at this point I'm mostly convinced writing portable code with the Objective-C runtime directly is impossible. I'm going to investigate the possibility of switching to using Objective-C directly and do that today; this may require having to rewrite the types in Objective-C directly. I'm not sure how this will affect the other use of objc_getClass() (to get classes for making instances).

In the meantime, you can fix your immediate problem locally with

diff --git a/objc_darwin.go b/objc_darwin.go
index c1b610d..d1fae75 100644
--- a/objc_darwin.go
+++ b/objc_darwin.go
@@ -18,7 +18,7 @@ func objc_getClass(class string) C.id {
    cclass := C.CString(class)
    defer C.free(unsafe.Pointer(cclass))

-   return C.objc_getClass(cclass)
+   return C.id(C.objc_getClass(cclass))
 }

 func sel_getUid(sel string) C.SEL {

from ui.

nf avatar nf commented on July 24, 2024

That change doesn't fix the build for me (10.9.2 also). I get

./objc_darwin.go:21: cannot convert _Cfunc_objc_getClass(cclass) (type C.Class) to type C.id

from ui.

shenyp09 avatar shenyp09 commented on July 24, 2024

Yes. I have tried to convert C.Class to C.id and get the same result with nf. Clearly it's unable to change C.Class to to C.id directly(Maybe just cannot do that convert just under OSX 10.9.2).

from ui.

andlabs avatar andlabs commented on July 24, 2024

I see, hm... I'm in the process of doing the Objective-C conversion; hopefully by tonight or tomorrow I'll have pushed everything and we can try again. This conversion will get rid of that C.objc_getClass() call (or anything working with Class directly).

from ui.

andlabs avatar andlabs commented on July 24, 2024

Conversion finished. Does it work now?

from ui.

shenyp09 avatar shenyp09 commented on July 24, 2024

Great! It works now. BTW, there is still a warning when building the package, but it seems not a serious problem.

github.com/andlabs/ui

Documents/Go/src/github.com/andlabs/ui/objc_darwin.m:23:9: warning: returning 'const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

from ui.

andlabs avatar andlabs commented on July 24, 2024

Right; I'll take care of that soon, as well as any other warnings that may come up when -Wall -Wextra are added. Thanks!

from ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.