I've been trying to call a foreign function in a 64-bit .dll library I wrote in c++ on Windows, and I keep getting the following error:
Code: Select all
LCB Error in file <folder with my lcb file>/cairoomdbodbc.lcb at line 13: unable to load foreign library
Hint: runtime
Code: Select all
<folder with my lcb file>/code/x86-win32
I'm not a seasoned c++ developer, so I'm hoping someone here *is* and may shed some light on this.
Here's the source code of my LCB library:
cairoomdbodbc.lcb
Code: Select all
library co.za.cairoo.cairoomdbodbc
metadata title is "CAIROO MDB ODBC Data Source Library"
metadata author is "Gerrie van Tonder"
metadata version is "1.0.0"
metadata os is "windows"
use com.livecode.foreign
private foreign handler _createCairooOdbcDataSource ( in pDbFilePath as ZStringNative ) returns ZStringNative binds to "c:cairoomdbodbc>createCairooOdbcDataSource"
public unsafe handler createCairooOdbcDataSource ( in pDbFilePath as String ) returns String
return _createCairooOdbcDataSource ( pDbFilePath )
end handler
end library
cairoomdbodbc.h
Code: Select all
_declspec(dllexport) const char * __cdecl createCairooOdbcDataSource(char *DbFilePath);
Code: Select all
#include <windows.h>
#include <odbcinst.h>
#include "cairoomdbodbc.h"
const char * createCairooOdbcDataSource(char *DbFilePath)
{
...redacted...
BOOL theResult = ...redacted...
...redacted...
if (theResult == 1)
{
return "true";
}
else
{
return "false";
}
}