Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to call swift and its functions from qt using c++ as wrappers?
Forum Updated to NodeBB v4.3 + New Features

How to call swift and its functions from qt using c++ as wrappers?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 591 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deleted569
    wrote on last edited by
    #1

    How to call swift and its functions from qt using c++ as wrappers ? I don't want any suggestions and want only the exact method to this solution.

    JonBJ 1 Reply Last reply
    0
    • D deleted569

      How to call swift and its functions from qt using c++ as wrappers ? I don't want any suggestions and want only the exact method to this solution.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @1km7kt1hi said in How to call swift and its functions from qt using c++ as wrappers?:

      I don't want any suggestions and want only the exact method to this solution.

      Hello and welcome.

      That is quite demanding for a first question, and you may not like the answer. Calling e.g. Swift functions has nothing to do with Qt, you will do it by however you choose to call them from C++. Which is a question for a Swift/C++ forum, not Qt. Since you don't want suggestions I won't tell you how to do that, but there are plenty of answers/examples out there on the web.

      D 1 Reply Last reply
      0
      • JonBJ JonB

        @1km7kt1hi said in How to call swift and its functions from qt using c++ as wrappers?:

        I don't want any suggestions and want only the exact method to this solution.

        Hello and welcome.

        That is quite demanding for a first question, and you may not like the answer. Calling e.g. Swift functions has nothing to do with Qt, you will do it by however you choose to call them from C++. Which is a question for a Swift/C++ forum, not Qt. Since you don't want suggestions I won't tell you how to do that, but there are plenty of answers/examples out there on the web.

        D Offline
        D Offline
        deleted569
        wrote on last edited by
        #3

        Since you don't want suggestions I won't tell you how to do that, but there are plenty of answers/examples out there on the web.

        Ok, I might have been rude, can you please tell me a suggestion ?

        JonBJ 1 Reply Last reply
        0
        • D deleted569

          Since you don't want suggestions I won't tell you how to do that, but there are plenty of answers/examples out there on the web.

          Ok, I might have been rude, can you please tell me a suggestion ?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @1km7kt1hi said in How to call swift and its functions from qt using c++ as wrappers?:

          Ok, I might have been rude

          :) Just Google as I did for call swift function from c++. Read through/follow whichever of the suggestions you like. From what I can see as of July 2020

          First, while it looks Swift will have a great support for C++ in the near future, for now you will need to create simple C wrappers to your interfaces.

          or there appears to be this https://github.com/scapix-com/scapix project to help.

          Unlike C++ or Swift, Qt is not a programming language. It is just a set of libraries/toolkit to be used from a C++ program. If you are using Qt .pro files/Creator for your building:

          • Put any required #includes into your source file(s).
          • If necessary for these to find the .h files in some directory, alter INCLUDEPATH (.pro file) to tell it where to find them.
          • Alter LIBS (.pro file) to specify linker arguments for your compiler to specify the directory where whatever Swift library files are situated and what library file names need to be linked with, e.g. like:
            LIBS += -L/path/to/swift/C++/link/libraries/directory -lname_of_swift_library_file

          You will have to see which of the above steps are relevant for Swift.

          D 1 Reply Last reply
          1
          • JonBJ JonB

            @1km7kt1hi said in How to call swift and its functions from qt using c++ as wrappers?:

            Ok, I might have been rude

            :) Just Google as I did for call swift function from c++. Read through/follow whichever of the suggestions you like. From what I can see as of July 2020

            First, while it looks Swift will have a great support for C++ in the near future, for now you will need to create simple C wrappers to your interfaces.

            or there appears to be this https://github.com/scapix-com/scapix project to help.

            Unlike C++ or Swift, Qt is not a programming language. It is just a set of libraries/toolkit to be used from a C++ program. If you are using Qt .pro files/Creator for your building:

            • Put any required #includes into your source file(s).
            • If necessary for these to find the .h files in some directory, alter INCLUDEPATH (.pro file) to tell it where to find them.
            • Alter LIBS (.pro file) to specify linker arguments for your compiler to specify the directory where whatever Swift library files are situated and what library file names need to be linked with, e.g. like:
              LIBS += -L/path/to/swift/C++/link/libraries/directory -lname_of_swift_library_file

            You will have to see which of the above steps are relevant for Swift.

            D Offline
            D Offline
            deleted569
            wrote on last edited by
            #5

            there appears to be this https://github.com/scapix-com/scapix project to help.

            Thanks, but how to use it to wrap swift into c++? The given instruction on the README.md file is only about Java.

            JonBJ 1 Reply Last reply
            0
            • D deleted569

              there appears to be this https://github.com/scapix-com/scapix project to help.

              Thanks, but how to use it to wrap swift into c++? The given instruction on the README.md file is only about Java.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @1km7kt1hi
              The two links I gave you both claim to show/offer bindings from C++ to Swift. And there are other examples/links from the Google.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved