I hate to assume but I'm guessing that it's normal for Dependency Walker to throw a bunch of errors for files it can't find.
Other than that, the function names look fine. They are undecorated, which simplifies things, but I'm not sure what I'm doing wrong here.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Data.Odbc;
namespace Adder
{
public class Class1
{
// This is required for any AGK DLL.
[DllExport("ReceiveAGKPtr", CallingConvention = CallingConvention.Cdecl)]
static public int ReceiveAGKPtr()
{
return 0;
}
// Your functions
[DllExport("DBConnect", CallingConvention = CallingConvention.Cdecl)]
static public int DBConnect(string ConnString)
{
OdbcConnection conn;
conn = new OdbcConnection(ConnString);
conn.Open();
if (conn.State.ToString() == "Closed")
{
return 0;
}
else
{
return 1;
}
}
}
}
The C# code for a test connection to a MySQL database
SetErrorMode(2)
#import_plugin DBConn
connStr as string = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=192.168.2.11; DATABASE=worldsapart; User=***; Password=***; OPTION=3;"
DB = dbconnect(connStr)
// set window properties
SetWindowTitle( "DBConn Test" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
do
Print(DB)
Print( ScreenFPS() )
Sync()
loop
AppGameKit Test Code
ReceiveAGKPtr,0,0,ReceiveAGKPtr,0,0,0,0
DBConnect,I,S,DBConnect,0,0,0,0
Commands.txt file