- Home /
EntryPointNotFoundException, when trying to import DLL. Help please :)
Hi all, I'm having some errors with a DLL I created but I don't know why...
This is the error:
EntryPointNotFoundException: text2Speech
TTSFestival.OnMouseUp () (at Assets/Scripts/TTSFestival.cs:20)
UnityEngine.SendMouseEvents:DoSendMouseEvents()
This my script:
using UnityEngine;
using System;
using System.Collections;
using System.Runtime.InteropServices;
public class TTSFestival : MonoBehaviour
{
//[DllImport ("TTSPlugin", EntryPoint="text2Speech")] private static extern int text2Speech(string message, string voice);
[DllImport ("TTSPlugin")] private static extern void text2Speech(string message, string voice);
public string voice = "english";
public string message ="Text";
void OnMouseUp () {
text2Speech(message, voice);
}
}
And this my DLL code:
#if _MSC_VER // this is defined when compiling with Visual Studio
#define EXPORT_API __declspec(dllexport) // Visual Studio needs annotating exported functions with this
#else
#define EXPORT_API // XCode does not need annotating exported functions, so define is empty
#endif
// ------------------------------------------------------------------------
// Plugin itself
#include <sstream>
#include <string>
// Link following functions C-style (required for plugins)
extern "C"
{
void EXPORT_API text2Speech(std::string message, std::string voice)
{
std::stringstream commandoss;
std::string commandos,msg;
commandoss << "start /B festival.exe --libdir \"festival/lib\" ";
commandoss << voice;
commandoss << " -A -T \"";
msg=message;//.toStdString();
//std::replace_if(msg.begin(),msg.end(),boost::is_any_of("\""),', ');
commandoss << msg;
commandoss << "\"";
commandos = commandoss.str();
system(commandos.c_str());
}
} // end of export C block
Any kind of help is welcomed :))
Answer by Mike 3 · Jun 30, 2011 at 11:23 AM
You'll probably need const char* instead of std::string for the message and voice parameters in the native code
And what about stringstream and other std::strings¿? If I add char* there I have to update my sript? Changing there to char* I have compilation errors. If I don't change the script (changing the DLL) I get same error.... Thanks!
Generally you just stick to const char* for c#'s string and char* for c#'s StringBuilder. Besides that, you'll probably just need to create your std::strings etc from those two in the native code
Your answer
Follow this Question
Related Questions
EntryPointNotFoundException - .so plugin (Linux) 0 Answers
Cant link PLUGIN.DLL with PLUGIN-EDITOR.DLL 1 Answer
Unity plugins 0 Answers
Soomla Error for android 1 Answer