This project has moved. For the latest updates, please go here.
1

Closed

Can I use import?

description

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

comments

vineetchoudhary wrote May 3, 2016 at 6:23 PM

No, currently you can't.

tinysun wrote May 9, 2016 at 8: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.map
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 6:44 AM

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