Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6722183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:25:02+00:00 2026-05-26T09:25:02+00:00

Here is the cpp code to call the dll function typedef void (__stdcall *Terminal)(TApplication*,

  • 0

Here is the cpp code to call the dll function”

typedef void (__stdcall *Terminal)(TApplication*, TFileStream *k, HANDLE N, int D);

Here is my C# code to call the function”

[DllImport("somedll.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
static extern void terminal(IntPtr Application, IntPtr FileStream, IntPtr CommHandle, int mode);

and the function call:

terminal(IntPtr.Zero, FileHandle.DangerousGetHandle(), CommHandle, 0);

if i call terminal with the Application ptr set to this.Handle i get a System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:25:02+00:00Added an answer on May 26, 2026 at 9:25 am

    You can’t create a Delphi TApplication from .net. You can’t create a Delphi TFileStream from .net. This DLL appears to be inaccessible from anything other than Delphi or C++ Builder.

    The only way you could hope for it to work from .net would be if the DLL also exported functions that created instances of TApplication or TFileStream, which you could then pass on to the function in your question.

    The TApplication class is a VCL class representing the application. It is the equivalent of the WinForms Application class. Likewise TFileStream is a VCL class wrapping file I/O in a stream-like interface. The .net FileStream class is similar. But you simply cannot synthesise working instances of Delphi/VCL classes from .net.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the code : #include <stdio.h> class Base { public: virtual void gogo(int a){
Still working on a problem that started from here Calling C++ dll function from
I am not able to call a function in cpp file from c file
Here is my code, which takes two version identifiers in the form 1, 5,
I'm learning about Thread Local Storage... (TLS) Here is my TLS Alloc code: //global
I am trying to call Matlab functions from C++ code. With Matlab it comes
I have tried to implement doubly linked list in C++. Here is the code,
I'm trying to call a nonmember function of a derived class from a base
I have a piece of C code that is used from a C++ function.
I guess I'm not linking something right? I want to call ABC.cpp which needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.