Code Monkey home page Code Monkey logo

dart-embedding-example's People

Contributors

fuzzybinary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dart-embedding-example's Issues

question about libdart

After I build , there is no libdart.a but libdart_precompiled_runtime.a.

When I link it report can not find symbol:
dart::bin::observatory_assets_archive, dart::bin::observatory_assets_archive_len, CompileAndReadScript

I want to link and run AOT binary , I guess I has to replace CompileAndReadScript part. please help to give some tips.

Issue when building the library using ninja

I've just been trying to follow along with the readme to get the embedding example set up but have hit a snag in the "Modifying some GN files" section of the doc. Namely, when trying to execute the ninja libdart command in the generated DebugX64 directory, I get the following error:

C:\src\depot_tools\dart-sdk\sdk\out\DebugX64>ninja libdart
ninja: error: unknown target 'libdart', did you mean 'dart'?

I'm not sure if this is caused by incorrectly generating the ninja files in previous steps or if changes have been made to the Dart SDK or depot_tools that would've changed the target I'd be attempting to build, so I was wondering if you might be able shed a little light on that.

Additionally, how do you actually run the code in this repo? Simply cloning it into Visual Studio and attempting a build throws the following error:

\dart-embedding-example\dart\platform\assert.h(12,1): fatal error C1189: #error: neither DEBUG nor NDEBUG defined

Does the source need to be placed within the depot_tools\dart-sdk directory and then built from within there? Or is it something else that I'm missing entirely?

Thanks in advance!

Could this approach be used to enable building shared/static libs for Dart, the same way that .NET does?

Heya -- thank you for maintaining these examples!

As far as I can tell, you've never been able to build shared/static libs with Dart Native. Only binaries.

Looking at the embedding example and the embedding API here, I'm curious if the approach that .NET took with DNNE (Dotnet Native Exports) would be viable?

The way this works is that you can mark functions with an attribute, to be exported (and the C99 code to generate for it if needed). At build time, it uses reflection to codegen a .h that:

  1. Initializes the .NET VM
  2. Loads in your program code
  3. Sets function pointer definitions by reading them from the VM

And then it compiles this for you automatically.

private const string ReaperPluginInfoStructString = @"
  struct reaper_plugin_info_t
  {
    int caller_version;
    void* hwnd_main;
    int (*Register)(const char* name, void* infostruct);
    void* (*GetFunc)(const char* name);
  };
";

public struct ReaperPluginInfo {} // omitted

[UnmanagedCallersOnly]
[DNNE.C99DeclCode(ReaperPluginInfoStructString)]
public static int ReaperPluginEntry(IntPtr hInstance, [DNNE.C99Type("struct reaper_plugin_info_t*")] ReaperPluginInfo* rec)
// Auto-generated by dnne-gen
// .NET Assembly: ReaperDNNE

// Declare exported functions
#ifndef __DNNE_GENERATED_HEADER_REAPERDNNE__
#define __DNNE_GENERATED_HEADER_REAPERDNNE__

#include <stddef.h>
#include <stdint.h>
#include <dnne.h>

// Additional code provided by user
      struct reaper_plugin_info_t
      {
        int caller_version;
        void* hwnd_main;
        int (*Register)(const char* name, void* infostruct);
        void* (*GetFunc)(const char* name);
      };
    

// Computed from ReaperDNNE.MyReaperPlugin.ReaperPluginEntry
DNNE_API int32_t DNNE_CALLTYPE ReaperPluginEntry(intptr_t hInstance, struct reaper_plugin_info_t* rec);

#endif // __DNNE_GENERATED_HEADER_REAPERDNNE__

// Define exported functions
#ifdef DNNE_COMPILE_AS_SOURCE

// Forward declarations
extern void* get_callable_managed_function(
    const char_t* dotnet_type,
    const char_t* dotnet_type_method,
    const char_t* dotnet_delegate_type);

extern void* get_fast_callable_managed_function(
    const char_t* dotnet_type,
    const char_t* dotnet_type_method);

// String constants
static const char_t* t1_name = DNNE_STR("ReaperDNNE.MyReaperPlugin, ReaperDNNE");

// Exports
// Computed from ReaperDNNE.MyReaperPlugin.ReaperPluginEntry
static int32_t (DNNE_CALLTYPE* ReaperPluginEntry_ptr)(intptr_t hInstance, struct reaper_plugin_info_t* rec);
DNNE_API int32_t DNNE_CALLTYPE ReaperPluginEntry(intptr_t hInstance, struct reaper_plugin_info_t* rec)
{
    if (ReaperPluginEntry_ptr == NULL)
    {
        const char_t* methodName = DNNE_STR("ReaperPluginEntry");
        ReaperPluginEntry_ptr = get_fast_callable_managed_function(t1_name, methodName);
    }
    return ReaperPluginEntry_ptr(hInstance, rec);
}

#endif // DNNE_COMPILE_AS_SOURCE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.