Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to manage DLL with complex parameters?

How to manage DLL with complex parameters?

Scheduled Pinned Locked Moved C#
csharpdata-structureshelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abiisalwayshappy
    wrote on last edited by
    #1

    I have a compiled DLL by VC6.0, in with: #include "argedit.h" #include "allocpool.h" template class StreamARGLoader: public ARGEdit { public: typedef Allocator NodeAllocator; typedef Allocator EdgeAllocator; StreamARGLoader(NodeAllocator *nalloc, EdgeAllocator *ealloc, istream &in); static void write(ostream &out, ARGraph &g); static void write(ostream &out, ARGLoader &g); private: enum { MAX_LINE=512 }; void readLine(istream &in, char *line); int readCount(istream &in); void readNode(NodeAllocator *alloc, istream &in); void readEdge(EdgeAllocator *alloc, istream &in); }; instruction file : int main() { // Create the allocators NewAllocator node_allocator; NullAllocator edge_allocator; // Open the file ifstream in("graph.txt"); // Create the ARGLoader StreamARGLoader loader(&node_allocator, &edge_allocator, in); // Build the graph ARGraph graph(&loader); //...... And finally hihi i don't know how to using it in C#, i face problem about NodeAllocator and istream &in Is this "StreamARGLoader" a void or a function? [DllImport("GraphMatching270606.dll", EntryPoint="StreamARGLoader",CharSet=CharSet.Auto)] public static extern void StreamARGLoader(NodeAllocator *nalloc, EdgeAllocator *ealloc, istream &in);

    J 1 Reply Last reply
    0
    • A abiisalwayshappy

      I have a compiled DLL by VC6.0, in with: #include "argedit.h" #include "allocpool.h" template class StreamARGLoader: public ARGEdit { public: typedef Allocator NodeAllocator; typedef Allocator EdgeAllocator; StreamARGLoader(NodeAllocator *nalloc, EdgeAllocator *ealloc, istream &in); static void write(ostream &out, ARGraph &g); static void write(ostream &out, ARGLoader &g); private: enum { MAX_LINE=512 }; void readLine(istream &in, char *line); int readCount(istream &in); void readNode(NodeAllocator *alloc, istream &in); void readEdge(EdgeAllocator *alloc, istream &in); }; instruction file : int main() { // Create the allocators NewAllocator node_allocator; NullAllocator edge_allocator; // Open the file ifstream in("graph.txt"); // Create the ARGLoader StreamARGLoader loader(&node_allocator, &edge_allocator, in); // Build the graph ARGraph graph(&loader); //...... And finally hihi i don't know how to using it in C#, i face problem about NodeAllocator and istream &in Is this "StreamARGLoader" a void or a function? [DllImport("GraphMatching270606.dll", EntryPoint="StreamARGLoader",CharSet=CharSet.Auto)] public static extern void StreamARGLoader(NodeAllocator *nalloc, EdgeAllocator *ealloc, istream &in);

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      STreamArgLoader is a template class. You're gonna have one helluva time trying to expose that to C#. It's basically impossible, AFAIK. What you *can* do, though, is write a C++/CLI class that does the manipulation of the StreamARGLoader class instance. C++/CLI methods are automatically exposed to all .NET assemblies, including C#, and can still deal with regular native C++ classes including template classes. That's what I would do: write a C++/CLI shim that does whatever your C# code needs to do to the StreamARGLoader.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Goof around music jam with my brothers (with video) The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups