Help!? extern stdcall -> to managed code.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Help!? extern stdcall -> to managed code.

  1. #1
    Vlad Ivanov Guest

    Help!? extern stdcall -> to managed code.


    I have an application that makes an _stdcall to an exported function within
    a DLL called "CreatePluginInstance".

    What i am trying to do - is to write an adapter in C++ that will export the
    required "CreatePluginInstance" function and internally proxy all the calls
    to an assembly written in VB.Net

    And i hit a wall - as soon as i enable managed extensions in C++ - the resulting
    DLL's extern "C" _stdcall CreatePluginInstance exported function cannot be
    called any longer. But i need the managed extensions to be able to load the
    assembly!

    So how can i have exported functions and calls to managed assembly in the
    same component? It seems to be either/or. Please let me know if this is possible.
    The only way i see this can be done - is to call the dotnet assembly using
    COM interop without using managed extensions. But i specifically want to
    avoid that due to performance reasons - and want to proxy the data into managed
    assembly directly.

    Can this be done?



  2. #2
    Rob Teixeira Guest

    Re: Help!? extern stdcall -> to managed code.



    You can use P/Invoke to get at the function (not COM interop, though they
    have similarities).

    Only BLT'able types can be marshaled directly (types that have the same physical
    structure in managed/unmanaged code, such as simple numerics).

    An easier way of doing all this may be to head over to Desaware. They have
    a component that does this for you, and I believe they just released it for
    .NET.

    -Rob


    "Vlad Ivanov" <nomail@nomail.com> wrote:
    >
    >I have an application that makes an _stdcall to an exported function within
    >a DLL called "CreatePluginInstance".
    >
    >What i am trying to do - is to write an adapter in C++ that will export

    the
    >required "CreatePluginInstance" function and internally proxy all the calls
    >to an assembly written in VB.Net
    >
    >And i hit a wall - as soon as i enable managed extensions in C++ - the resulting
    >DLL's extern "C" _stdcall CreatePluginInstance exported function cannot

    be
    >called any longer. But i need the managed extensions to be able to load

    the
    >assembly!
    >
    >So how can i have exported functions and calls to managed assembly in the
    >same component? It seems to be either/or. Please let me know if this is

    possible.
    >The only way i see this can be done - is to call the dotnet assembly using
    >COM interop without using managed extensions. But i specifically want to
    >avoid that due to performance reasons - and want to proxy the data into

    managed
    >assembly directly.
    >
    >Can this be done?
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center