hello,
i have created C static library with simple function declared in header and implemented in .c file
like:
int mylibfnc(); (in .h file)
and
.c file:
int mylibfnc()
{
return 123;
}
compiled -> static mylib.lib has been created
now how to allow calling of this function in my .swift file?
i tried analogically (as other libs in existing C:\Library folder created by windows swift installator) to copy header file and create module.map
module MYLIB [extern_c] [system] {
umbrella header "mylib.h"
}
at location:
c:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\MYLIB
(as modul declaration)
and
add my mylib.lib at location c:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\x86_64
assuming that lib is being "registred" and inner function becomes usable after
import MYLIB in my swift file
after using
set SWIFTFLAGS=-sdk %SDKROOT% -resource-dir %SDKROOT%\usr\lib\swift -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows
and
swiftc %SWIFTFLAGS% -emit-executable -o helloWorld.exe helloWorld.swift
there is compilation error of unresolved external symbol mylibfnc
could you please help me to run the most simple application?
let's say, i have simple helloWorld.swift
how to run function from static lib compiled by visual studio?
where should i copy .h file and .lib file, how to let swift now about .lib implementation?
has to be next to my swift file some parametrized json with specifications?
could you offer little example pls?
thank you very much