Note that there are some explanatory texts on larger screens.

plurals
  1. POC++/CLI managed wrapper around C static library
    primarykey
    data
    text
    <p>Help!</p> <p>I'm totally exhausted/frustrated with what seems to be a reasonably easy task. I’m not sure what I'm doing wrong; let alone if I'm doing it correct. I'm "required" to use an existing library (a C static library – over 100,000 lines of straight C code) in developing a WPF application (VS 2010, C# 4.0). Oh, and I can't touch the existing C code - use it as is!</p> <p>I've read so many postings (advanced topics, how-to, etc), yet I'm so new to C++/CLI that it's just not making sense. From what I've read the best approach is to wrap the C static library as follows:</p> <blockquote> <p>Unmanaged C static library &lt;---> C++/CLI managed wrapper DLL &lt;---> managed WPF application</p> </blockquote> <p>This is the stripped down C header file:</p> <pre><code>/* Call this function to execute a command. */ int issue_command(int command, long param1, long param2); /* Completion call back function; you must supply a definition. */ extern int command_completed(int command, long param1, long param2); struct struct_command_str { char command_str[10]; char param1_st[2]; char param2_st[2]; char success; }; /* You must supply definitions to the following extern items. */ extern int command_status; extern struct struct_command_str command_str; </code></pre> <p><strong>The problem(s):</strong></p> <p>What I can’t seem to do correctly is provide a C++/CLI implementation for the call back functions, and the two extern items (<code>command_status</code> and struct <code>command_str</code>).</p> <p>Can someone provide a sample C++/CLI implementation for the above missing call back functions and externs?</p> <p>Thanks in advance for your assistance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload