Implementing "import" for share libs #42
Replies: 4 comments
-
but for now it is possible to load functions from shared lib manually. One of the examples: function LLVMLoadLibraryPermanently(filename: string): TypeOf<1>;
function LLVMSearchForAddressOfSymbol(symbolName: string): Opaque;
function LoadFunction(dllName: string, funcName: string)
{
LLVMLoadLibraryPermanently(dllName);
return LLVMSearchForAddressOfSymbol(funcName);
}
let test1: () => void = LoadFunction("./1.dll", "test1");
function main()
{
test1();
} It is importent to link |
Beta Was this translation helpful? Give feedback.
-
or to use internal commands the above code can be reduced to function LoadFunction(dllName: string, funcName: string)
{
LoadLibraryPermanently(dllName);
return SearchForAddressOfSymbol(funcName);
}
let test1: () => void = LoadFunction("./1.dll", "test1");
function main()
{
test1();
} |
Beta Was this translation helpful? Give feedback.
-
Shared library should have file with "export" function and without Example: export function test1()
{
print("Hello World!");
} |
Beta Was this translation helpful? Give feedback.
-
first example is ready |
Beta Was this translation helpful? Give feedback.
-
Thinking about implement support for shared libs.
Beta Was this translation helpful? Give feedback.
All reactions