Project

General

Profile

Actions

Defect #661

open

Running of dynamic library functions through Windows API fails

Added by Runar Tenfjord about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Category:
Oberon Front-End
Target version:
-
% Done:

0%


Description

I ported directly some code I have used with the XDS compiler which loads the Sqlite dll at runtime trough the Windows API LoadLibraryA and GetProcAddress functions. (I see the corresponding Linux/BSD functions is currently not available)

It compiles OK and seems to correctly load the DLL and find the functions, but I get a segmentation fault when
calling the loaded procedure.

Attached is the (reduced) code and it expect the 'sqlite3.dll' in the local path in order to work.

This maybe has something to do with calling convention difference between Oberon and Windows?


Files

DBSQLite3Dll.mod (962 Bytes) DBSQLite3Dll.mod Interface code Runar Tenfjord, 28 June 2024 20:32
OSDllWin.mod (618 Bytes) OSDllWin.mod Wrapper of Windows API Runar Tenfjord, 28 June 2024 20:32
Test.mod (101 Bytes) Test.mod Test module Runar Tenfjord, 28 June 2024 20:32
Actions #1

Updated by Florian Negele about 1 year ago

Calling dynamically-loaded functions is not supported at the moment. The problem is indeed the different calling convention. You could try and statically link against this library. The files runtime/winsdl.cpp and libraries/oberon/api.sdl.mod should give you a basic idea.

Actions #2

Updated by Runar Tenfjord about 1 year ago

Thanks for your prompt response.
I will have a look at the referenced files for a workaround.

Actions

Also available in: Atom PDF