Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8193139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:22:50+00:00 2026-06-07T04:22:50+00:00

I make a interface class in C++ for voice recognition, i´m using the Julius

  • 0

I make a interface class in C++ for voice recognition, i´m using the Julius API. http://julius.sourceforge.jp/en_index.php?q=index-en.html.

Well, my class has some events, these events will be triggered by the Julius API.
The Julius API has the function call callback_add with this signature:

int callback_add (Recog *recog, int code, void(*func)(Recog *recog, void *data), void data)

I using some ‘proxy’ functions to Invoke the events and passing this functions to callback_add.

If the property event is static, it works fine, but if is a non static, inside the proxy function the property not be recognized.

The difficult is because I have to use the callback_add function and can’t modify this.

Here is a summary of the class with 2 events (static and non-static)

Header

#ifndef FALAENGINE_H_
#define FALAENGINE_H_

#pragma once

extern "C"{
#include <julius/julius.h>
}

namespace FalaAPI {

    public ref class FalaEngine
    {
    public:
        FalaEngine();
        ~FalaEngine();

        // Events
        delegate void OnRecognizedDele(FalaAPI::RecoResult^ result);
        static property OnRecognizedDele^ OnRecognized;

        delegate void OnEngineStartDele();
        property OnEngineStartDele^ OnEngineStart;

    private:
        Recog *recog;
        Jconf *jconf;
    };
}

#endif /* FALAENGINE_H_*/

Source

#include "stdafx.h"

using System::String;
using System::Console;

#include "FalaEngine.h"
#include <windows.h>

namespace FalaAPI{
    void StartOnEngineStart()(Recog *recog, void * dummy){
        if(FalaEngine::OnEngineStart->GetInvocationList()->Length > 0)
            FalaEngine::OnEngineStart->Invoke();
    }

    void StartOnRecognized()(Recog *recog, void * dummy){
        if(FalaEngine::OnRecognized->GetInvocationList()->Length > 0)
            FalaEngine::OnRecognized->Invoke();
    }

    FalaEngine::FalaEngine(){
        recog = j_recog_new();
        jconf = j_jconf_new();

        //Julius callback Functions
        callback_add(recog, CALLBACK_EVENT_PROCESS_ONLINE, StartOnEngineStart, NULL);

        callback_add(recog, CALLBACK_RESULT, StartOnRecognized, NULL);
    }
}

The problem occurs inside StartOnEngineStart function:

error C2227: left of ‘->GetInvocationList’ must point to class/struct/union/generic type

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:22:51+00:00Added an answer on June 7, 2026 at 4:22 am

    A non-static member exists separately in each instance. You haven’t specified which instance contains the delegate you want to inspect, you’ve only specified a class (and there may be many instances).

    Try using the dummy parameter to pass your instance. But be careful, because the garbage collector will move objects around unless you have pinned them, so simply passing the address will not work. You need to create and pass a GCHandle instead. (Be careful not to leak the GCHandle, or your object will never be released)


    Something like this should be effective:

    ref class FalaEngine;
    
    struct EngineHandle
    {
        gcroot<FalaEngine^> handle;
        EngineHandle(FalaEngine^ engine) : handle(engine) {}
    };
    
    public ref class FalaEngine
    {
        clr_scoped_ptr<EngineHandle> callback_ptr;
    public:
        FalaEngine();
        ~FalaEngine();
    
        // Events
        delegate void OnRecognizedDele(FalaAPI::RecoResult^ result);
        property OnRecognizedDele^ OnRecognized;
    
    
        delegate void OnEngineStartDele();
        property OnEngineStartDele^ OnEngineStart;
    
    private:
        Recog *recog;
        Jconf *jconf;
    };
    
    void StartOnEngineStart(Recog *recog, void * dummy)
    {
        FalaEngine^ that = static_cast<EngineHandle*>(dummy)->handle;
        that->OnEngineStart(); // C++/CLI already checks if the invocation list is empty
    }
    
    
    void StartOnRecognized(Recog *recog, void * dummy)
    {
        FalaEngine^ that = static_cast<EngineHandle*>(dummy)->handle;
        that->OnRecognized(recog->get_result());
    }
    
    FalaEngine::FalaEngine()
        : callback_ptr(new EngineHandle(this))
    {
        recog = j_recog_new();
        jconf = j_jconf_new();
    
    
        //Julius callback Functions
        callback_add(recog, CALLBACK_EVENT_PROCESS_ONLINE, StartOnEngineStart, callback_ptr.get());
    
        callback_add(recog, CALLBACK_RESULT, StartOnRecognized, callback_ptr.get());
    
    }
    

    The clr_scoped_ptr class is here. There are not many license requirements, make sure you follow them though if you use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#define interface class (here is more - http://www.codeproject.com/KB/cpp/CppInterfaces.aspx ) Does that make sense? Does
I make a class level method for Alert: @interface TestAlert @end + (void)showErrorAlert:(NSTimer *)message
Is okay to break all dependencies using interfaces just to make a class testable?
I have to make a graphical user interface application using the language of my
Wiki said it used to make class,interface uniquely identifier , how about object (actual
I am writing a simple Interface class as below. I need to make only
I want to make an interface in C# that defines a method that always
I am about to start to make the interface for a game in WPF
I use Qt designer to make an interface and I have an QWebView in
I am trying to make the same user interface to preview image like on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.