Code: Select all
Dim s As zstring ptr
Dim as integer stack
Declare Function GetInput cdecl LIB "ConsoleInput" (ByRef prompt As zstring, ByRef prefill As zstring) As zString ptr
s=GetInput("What's your hobby? ", "programming") ' the second string is editable; cursor left/right, backspace, Escape to clear etc
printf("My hobby is %s", s)
The DLL is here. Now to the problem:
Since the moment when I first compiled this snippet using another name, i.e. LIB "MbMicroDll", the executable built with ConsoleInput complains that it cannot find MbMicroDll, even though the source clearly tells it to use ConsoleInput.
This is weird. For compiling, ConsoleInput.dll must be present (and only that one), for running I need MbMicro.dll (and only that one). I have the impression that the compiler "remembers" the first name used, which makes no sense. I even searched the registry, no luck. I have been fighting with this the whole night...
I use DLLs all the time (on Windows 7 & Win 10), this is my first attempt at using a DLL in FreeBasic, and well, it works like a charm but getting it to work requires really weird acrobatics. Any idea why the compiler behaves like this? Please don't point me to static linking, def files or dylibload & friends - the code above works fine, I simply want to know why the FB compiler confuses the names of DLLs.