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 585 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 11 Jun 2022, 04:59 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.

    J 1 Reply Last reply 11 Jun 2022, 07:35
    0
    • D deleted569
      11 Jun 2022, 04:59

      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.

      J Offline
      J Offline
      JonB
      wrote on 11 Jun 2022, 07:35 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 11 Jun 2022, 07:39
      0
      • J JonB
        11 Jun 2022, 07:35

        @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 11 Jun 2022, 07:39 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 ?

        J 1 Reply Last reply 11 Jun 2022, 08:01
        0
        • D deleted569
          11 Jun 2022, 07:39

          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 ?

          J Offline
          J Offline
          JonB
          wrote on 11 Jun 2022, 08:01 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 11 Jun 2022, 09:08
          1
          • J JonB
            11 Jun 2022, 08:01

            @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 11 Jun 2022, 09:08 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.

            J 1 Reply Last reply 11 Jun 2022, 09:43
            0
            • D deleted569
              11 Jun 2022, 09:08

              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.

              J Offline
              J Offline
              JonB
              wrote on 11 Jun 2022, 09:43 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

              1/6

              11 Jun 2022, 04:59

              • Login

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