How to call swift and its functions from qt using c++ as wrappers?
-
wrote on 11 Jun 2022, 04:59 last edited by
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.
-
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.
wrote on 11 Jun 2022, 07:35 last edited by@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.
-
@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.
wrote on 11 Jun 2022, 07:39 last edited bySince 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 ?
-
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 ?
wrote on 11 Jun 2022, 08:01 last edited by@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 2020First, 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
#include
s into your source file(s). - If necessary for these to find the
.h
files in some directory, alterINCLUDEPATH
(.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.
- Put any required
-
@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 2020First, 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
#include
s into your source file(s). - If necessary for these to find the
.h
files in some directory, alterINCLUDEPATH
(.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.
wrote on 11 Jun 2022, 09:08 last edited bythere 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.
- Put any required
-
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.
wrote on 11 Jun 2022, 09:43 last edited by@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/6