ID:1872168
 
(See the best response by Lummox JR.)
Hey folks, so I really enjoy working with c# and I found this post http://www.byond.com/forum/?post=1481007 about how to make external dlls that could be coded in c# and used in dream maker. I did a couple of tries but I am always getting this error when I build the solutionError 1 The "RGiesecke.DllExport.MSBuild.DllExportAppDomainIsolatedTask" task could not be loaded from the assembly C:\Users\Hammer\Documents\Visual Studio 2012\Projects\MYSQL_DLL\packages\UnmanagedExports.1.2.6\tool s\RGiesecke.DllExport.MSBuild.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. MYSQL_DLL


I have even tried with this simple and rudimentar lines of code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using RGiesecke.DllExport;
using System.Runtime.InteropServices;

using MySql.Data.MySqlClient;

namespace MYSQL_DLL
{
public class Class1
{

[DllExport("TEST", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.LPStr)]



public static String TEST(string TestString) { return TestString; }}

But the problem doesn't go away.... what am I doing wrong?

I've even tried to use the dll file that was created from those failed Builds on a simple DM project and I wrote this code:
mob/verb/TESTXX()
world<<call("MYSQL_DLL.dll","TEST")("JustTesting")


And this is what DM gave me in return...
runtime error: The specified procedure could not be found.

proc name: TESTXX (/mob/verb/TESTXX)
usr: Guest-4232088995 (/mob)
src: Guest-4232088995 (/mob)
call stack:
Guest-4232088995 (/mob): TESTXX()



What the hell am I doing wrong?
I'm working with visual studio Express 2012 for windows desktop,the platform that I'm using is x86,the Target framework is .NET Framework 4.5 and yes I have installed the UnmanagedExports stuff....

Oh I am also using windows 10 Technical Preview, idk if is relevant though
Thanks as always for your attention.
Hug
MistY

Best response
I suspect the answer to your build issue will have to be sought in a C# venue, or some place like Stackoverflow. BYOND is probably failing to load the procedure simply because of the DLL build errors.
In response to Lummox JR
I did some testing and I finally found out what was causing the problem.

1st.The OP (the Windows 10 TechPreview isn't meant for developing stuff. It is very unstable and uncomplete since it is only a preview)).

2nd. (and most important) Byond call proc doesn't accept arguments as String type. It only accepts char arguments so this <code>public static String Test(string texthere)</code> won't work since the argument that it requires is a string type argument. But if I write this instead <code>public static String Test(char texthere)</code> it will work because I'm inputing a char type argument.

This is why it wasn't working.... It made my head melt but nothing that a couple of tests and debugings won't fix :P

Thanks,
Hug,
MistY
Ah, didn't even notice that you were trying to use STL there. Yeah, it has to be char const*.
I'm so sorry for being so annoying but I'm having some troubles with this:

This is my function (the beginning of it of course... just the arguments):

public static String AddPlayer(char username, char password){


If I call this in DM
call("MysqlConnector","AddPlayer")("Misty","MyPass")


And if somewhere in my c# code I do this "insert into UsersIntel (Username, Password) values ('" + username + "','" + password + "')"; it won't insert the right values in my mysql database. I've tried to convert the char into a string by doing username.ToString() and password.ToString() but without any success. What do you think it is going on? Is there any way to solve this? I'm really tired and possibily this is just a dumb question but I can't rest while I don't figure this out....

Thanks and sorry again for keeping bothering you with this.

Hug,
,Misty,
Well that should be char const*, not char, because char is just a single character. That's not really a safe way to escape strings though.

Curious about one thing: Why not just use Dantom.DB which has built-in MySQL support? And SQLite is already built into the engine as well.
Oh ok ty. Humm about that, I just don't like very much the built-in Mysql support... I mean you guys have done a great job and I really congratulate byond team for implementing mysql in byond but I just prefer working with c# via dll
Fair enough.