SQLite Forum

Loading my extension: specified procedure can't be found
Login

Loading my extension: specified procedure can't be found

(1) By TomEggers on 2020-07-03 00:55:40 [link] [source]

I have written two SQLite3 extensions. Both compile/build with Visual Studio. The first one works great, the second one gets the message "The specified procedure could not be found." I have stripped the second one down to its bare essentials in an attempt to locate the problem. No luck. I would appreciate if somebody would try to compile/build then .load the extension. (The stripped-down extension is toAscii.dll, and does nothing but return its text argument.) I think the problem may be Visual Basic settings, so if the code below loads into SQLite3 without an error, then some help with VB settings would be appreciated.

//SQLite3 extension to return text argument (and nothing else)

#include "pch.h"

#include <c:\eMail\sqlite3ext.h> SQLITE_EXTENSION_INIT1

#ifdef __cplusplus extern "C" {

#endif

static void toAscii(
	sqlite3_context* context,
	int argc,
	sqlite3_value** argv
)
{
	char* text = (char*)sqlite3_value_text(argv[0]);	
	sqlite3_result_text(context, text, -1, SQLITE_TRANSIENT);
	return;
}

#ifdef _WIN32 __declspec(dllexport)

#endif

	int sqlite3_toAscii_init(
		sqlite3* db,
		char** pzErrMsg,
		const sqlite3_api_routines* pApi
	) {
	int rc = SQLITE_OK;
	SQLITE_EXTENSION_INIT2(pApi);
	(void)pzErrMsg;  /* Unused parameter */
	rc = sqlite3_create_function(db, "toAscii", 1,
		SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
		toAscii, 0, 0);
	return rc;
}

#ifdef __cplusplus }

#endif

(2) By TomEggers on 2020-07-03 01:29:48 in reply to 1 [link] [source]

Two corrections: (1) I used Visual Studio to compile/build, not Visual Basic, and (2) changing the name from toAscii.dll to toEnglish.dll everywhere doesn't help the problem.

(3) By TomEggers on 2020-07-03 01:34:35 in reply to 1 [link] [source]

Two corrections: (1) I used Visual Studio to compile/build, not Visual Basic, and (2) changing "toAscii" to "toEnglish" everywhere doesn't help the problem. (When I posted the problem, I hadn't realized there was a toAscii function somewhere.)

(4) By Keith Medcalf (kmedcalf) on 2020-07-03 02:57:46 in reply to 1 [link] [source]

Get rid of the capital letters in your init function name.

(5) By TomEggers on 2020-07-03 05:04:08 in reply to 4 [link] [source]

Thank you!!! That fixed the problem. So simple, and such a painful problem to find. I hope I didn't overlook that documented somewhere.

(6) By Warren Young (wyoung) on 2020-07-03 08:46:45 in reply to 5 [source]

Unlike VB, C is case-sensitive.

(7) By TomEggers on 2020-07-03 10:01:34 in reply to 6 [link] [source]

"VB" was an error: I meant "Visual Studio". (I couldn't figure out how to edit my post.) Yes, C++ is case sensitive. The point I was totally missing was that the text is REQUIRED to be all lower case. All is now clarified, my code works, and clams and I are now both happy. Thanks to everybody who replied.

(8) By Warren Young (wyoung) on 2020-07-03 10:56:38 in reply to 7 [link] [source]

Ah, I see now. From the docs:

it constructs a entry point using the template "sqlite3_X_init" where the X is replaced by the lowercase equivalent of every ASCII character in the filename