interop

Transferring vector of objects between C++ DLL and Cpp/CLI console project

点点圈 提交于 2019-12-10 11:13:51
问题 I have a C++ library app which talks to a C++ server and I am creating a vector of my custom class objects. But my Cpp/CLI console app(which interacts with native C++ ), throws a memory violation error when I try to return my custom class obj vector. Code Sample - In my native C++ class - std::vector<a> GetStuff(int x) { -- do stuff std::vector<a> vec; A a; vec.push_back(a); --- push more A objs return vec; } In my Cpp/CLI class public void doStuff() { std::vector<a> vec; vec = m_nativeCpp-

C++/CLI noob: System.AccessViolationException

耗尽温柔 提交于 2019-12-10 10:57:55
问题 I'm trying to put together a "cool demo" for a career day at my daughter's jr. high in 5 days and so I'm trying to use the echoprint library to perform over the air (OTA) audio recognition. I've never really gone much farther than "hello world" in C++ and I am trying to use C++/CLI to wrap the echoprint codegen library so I can call it from C#. Here's my header file: // echoprint-cli.h #pragma once #include "Codegen.h"; using namespace System; namespace echoprintcli { public ref class

pass unmanaged C++ method to C# dll for callback

一世执手 提交于 2019-12-10 10:43:49
问题 I have a .Net dll which I have registered and am able to call methods on from my C# code. I essentially followed this tutorial: http://support.microsoft.com/kb/828736 now I need to do something in c# asynchronously, so I need some way of telling the c++ code that I am done. I have created a method like so: public void Init(string server, IntPtr callback); which I can see in the c++ as: Init(BSTR server, long callback); I also need to pass a variable back to the c++ code when I make invoke it.

Unmanaged DLL causing AccessViolationException

醉酒当歌 提交于 2019-12-10 10:37:50
问题 This one is really starting to give me a headache :( I have an unmanaged DLL that I'm trying to interop with and it's not going well. The application will sometimes work...but most times, randomly through an AccessViolationException and crash horribly. I think I've narrowed it down to my mishandling of a single DllImport: C++ function: HTMLRENDERERDLL_REDIST_API void SetDataBuffer( int windowHandle, unsigned char* dataSource, int format, int stride, int totalBufferSize ); C# DllImport:

Communicate between c++ applications and web applications

有些话、适合烂在心里 提交于 2019-12-10 10:37:23
问题 What are the various ways I can achieve communication (like function calls) from a web application to a c++ application? I've developed the c++ application to do image processing and want to display and transmit the result in real time to a web-page displayed on a browser. 回答1: Nothing will 'transmit to a web browser'. Web browsers have to ask, and then you can respond with the data you want to display. As per @The MYYN, you can just have the C++ code drop suitable files and the browser can

Dart SDK 0.8.10.3_r29803 dart:js callbacks

久未见 提交于 2019-12-10 10:35:25
问题 Can some one please give me an example of the Dart code that would follow this flow 1) Dart call Javascript function 2) Javascript loads some data via Javascript api's 3) Javascript returns data to Dart Currently I can only call the Javascript function I need (via js.context.callMethod('myAmazingFunction');) but I can't receive the callback. I thought there would be something like js.context.listenForMethod('myAmazingCallback'); or similar... 回答1: Just pass your Dart function into JavaScript

JavaFX Script and Java

拟墨画扇 提交于 2019-12-10 09:50:37
问题 Simple question: Can I mix in my desktop application Java and JavaFX Script code? If it is possible could you provide me with some link with examples? Or could I pack my custom made javafx CustomNode-s in a jar and use them in my project side by side with standard SWING components? 回答1: This article gives an example of calling JavaFX from Java, using the Scripting API. 回答2: Yes, you can mix Java and JavaFX. According to one of the FAQ entries: In addition, developers can use any Java library

java mixed with clojure in maven and eclipse

半城伤御伤魂 提交于 2019-12-10 09:45:56
问题 i created a sample polyglot program. i have a sensor and a robot implemented in java and AI implemented in clojure. and i can't connect maven properly --src/main/java/clojuretest | DistanceSensor.java AI.clj (uses DistanceSensor) Robot.java (uses AI) DistanceSensor.java: package clojuretest; public class DistanceSensor { public int getValue() {return 5;} } AI.clj: (ns clojuretest.AI (:gen-class :methods [[isObstacleAhead [] boolean]])) (defn -isObstacleAhead [this] (< (.getValue (clojuretest

Is it possible to use OCaml in embedded mode?

萝らか妹 提交于 2019-12-10 09:31:19
问题 Some time ago I emerged for myself that Guile and Racket can be embedded and be called right from any C++ application. Can OCaml work like this? 回答1: You can have a look at the Embedded O'Caml Toplevel done by Clément Capel. It's the result of a summer internship so it wasn't updated since 2004. Otherwise, there is ocamlmklib. 回答2: You can use the OCaml toplevel as a library. It is part of the official OCaml distribution and up-to-date. See toploop.mli in OCaml sources for the interface. It

Replace MergeFields in a Word 2003 document and keep style

帅比萌擦擦* 提交于 2019-12-10 09:02:25
问题 I've been trying to create a library to replace the MergeFields on a Word 2003 document, everything works fine, except that I lose the style applied to the field when I replace it, is there a way to keep it? This is the code I'm using to replace the fields: private void FillFields2003(string template, Dictionary<string, string> values) { object missing = Missing.Value; var application = new ApplicationClass(); var document = new Microsoft.Office.Interop.Word.Document(); try { // Open the file