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 8144513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:24:16+00:00 2026-06-06T13:24:16+00:00

I have written a quick C++ DLL in Visual Studio, with a single function

  • 0

I have written a quick C++ DLL in Visual Studio, with a single function called ReportVersion() that returns 1.

int _stdcall ReportVersion() {
    return 1;
}

I then created a VB.net EXE to call this DLL.

Public Class Form1

    Private Declare Function ReportVersion Lib "Test_DLL.dll" () As Long

    Private Sub btnVersion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVersion.Click
        Call MsgBox(ReportVersion())
    End Sub
End Class

If I press F5 and run in either Release/Debug mode, the return value of ReportVersion is 6824607285638070273.

If I build the solution and run the .EXE manually, the return value is 1 (as expected).

Where on earth is it getting 6824607285638070273 from?

For reference, I used these 2 articles as examples for creating them

http://edais.mvps.org/Tutorials/CDLL/CDLLch1b.html

http://edais.mvps.org/Tutorials/CDLL/CDLLch2.html

As I’ve never done a call between DLL/Application written in different languages.

  • 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-06-06T13:24:17+00:00Added an answer on June 6, 2026 at 1:24 pm

    Having emailed the original author of the linked articles, I was pleasantly surprised to get a response back about such an old article. This helped me understand the problem.

    In VB6, the "Integer" type was a signed 16-bit integer, and the "Long"
    type was a signed 32-bit integer.

    In VB.NET, the "Integer" type is a
    signed 32-bit integer, and the "Long" type is a 64-bit signed integer.
    The "Short" type was also added to fill the 16-bit signed integer
    role.

    Indeed, if you convert the value given back to you by ReportVersion()
    above you’ll see it comes out to 0x5EB5E02B00000001. As you can see
    the low 8 digits (0x00000001) have the correct value in, where as the
    high digits just have whatever data happened to be in memory next to
    it at the time.

    As for the discrepancy between running as an executable as opposed to
    within the IDE, I can only imagine that perhaps that area of memory is
    being cleared out prior to the application running so it actually
    returns 0x0000000000000001 which is correctly evaluated as 1.

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

Sidebar

Related Questions

I have written a quick Java wrapper that fires off the NMAP executable and
I am starting out with MPI and have written a quick demo program: int
I have written following function public void TestSB() { string str = The quick
I have written a generic CSV file reader that I'm trying to use to
I have written a function for browser compatibility. When I pass objTR.cells[0] it works
I have written a code that draws grids and a triangle inside one grid
I have written the following function meant to update a student in my database:
I am just having a quick look at UIWebView and have written a small
I have written this code and in this the function gen() id used to
We have an old (written in CakePHP 1.1!) application that has started groaning under

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.