ImportC MariaDB

Mac OSX specific forum
wayne-c
Enthusiast
Enthusiast
Posts: 334
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

ImportC MariaDB

Post 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.
As you walk on by, Will you call my name? Or will you walk away?
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ImportC MariaDB

Post 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
Last edited by mk-soft on Thu Apr 22, 2021 3:41 pm, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
wayne-c
Enthusiast
Enthusiast
Posts: 334
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

Re: ImportC MariaDB

Post 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
As you walk on by, Will you call my name? Or will you walk away?
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ImportC MariaDB

Post by mk-soft »

ImportC "-lcurl" works, because its defined by macOX Xcode
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply