Page 1 of 1

ImportC MariaDB

Posted: Thu Apr 22, 2021 10:47 am
by wayne-c
Hello

What is the correct import for libmariadb on macOS?

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
	Import "libmariadb.lib"
		mysql_init(dbHwnd)
		; ...
	EndImport
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
	ImportC "*** WHAT COMES HERE? TRIED -lmariadb, -libmariadb, -lmysql; NONE OF THEM WORKED ***"
		mysql_init(dbHwnd)
		; ...
	EndImport
CompilerEndIf
Thank you, any help appreciated.

Re: ImportC MariaDB

Posted: Thu Apr 22, 2021 3:31 pm
by mk-soft
The library libmariadb is a Windows .dll, macOS .dylib, Linux .so

Only under Windows there is a description .lib

So include with OpenLibrary.

Link: viewtopic.php?f=7&t=75711

Re: ImportC MariaDB

Posted: Thu Apr 22, 2021 3:40 pm
by wayne-c
mk-soft wrote: Thu Apr 22, 2021 3:31 pm The library libmariadb is a Windows .dll, macOS .dylib, Linux .so

Only under Windows there is a description .lib

So include with OpenLibrary.
Assuming you're right, why does it then work with lib curl this way:

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
	ImportC "-lcurl"
		CurlVersion() As "_curl_version"
	EndImport
CompilerElseIf #PB_Compiler_OS = #PB_OS_Windows
	ImportC "libcurl.lib"
		CurlVersion() As "curl_version"
	EndImport
CompilerEndIf

Re: ImportC MariaDB

Posted: Thu Apr 22, 2021 3:45 pm
by mk-soft
ImportC "-lcurl" works, because its defined by macOX Xcode