• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by ytniu · Jun 30, 2011 at 10:31 AM · errorplugindll

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 :))

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image

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

Comment

People who like this

0 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ytniu · Jun 30, 2011 at 11:26 AM 0
Share

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!

avatar image Mike 3 · Jun 30, 2011 at 11:32 AM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to use Google Apps Script with Unity and create a simple application that makes requests to the Google Apps Script Execution API 0 Answers

EntryPointNotFoundException - .so plugin (Linux) 1 Answer

Using scripting #if define symbols in DLLs 1 Answer

Can I see debug log(ex:printf) from C++ dll in Unity? 0 Answers

How to make a native c++ dll for Unity in Macbook/OS X? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges