This project has moved and is read-only. For the latest updates, please go here.


Can I use import?


Ex: "import Foundation"
Closed Jun 12 at 8:49 PM by tinysun


vineetchoudhary wrote May 3, 2016 at 7:23 PM

No, currently you can't.

tinysun wrote May 9, 2016 at 9:57 AM

You can test the import feature.
  • 1) Create a directory : c:/SwiftForWindows/Swift/lib/swift/win32
  • 2) Create a file : c:/SwiftForWindows/Swift/lib/swift/win32/
module CWin32 {
   header "c:/Program Files (x86)/Windows Kits/8.1/Include/um/Windows.h"
   export *
  • 3) Create a test file : WinHello.swift
import CWin32

MessageBoxA(nil, "Hello, World", "Swift", 0)
  • 4) Run in interpreter mode
set PATH=%PATH%;c:/SwiftForWindows/Swift/bin;c:/SwiftForWindows/Swift/lib/swift/windows
swift WinHello.swift
  • You can show the popup message!
  • @vineetchoudhary, if you add the user32.lib to the option list of LINK.exe, we can compile and run this. Thanks for your nice GUI.

vineetchoudhary wrote May 12, 2016 at 7:44 AM

Thanks to you @tinysun. Your are the code behind" of this project.