Click here to Skip to main content
16,004,991 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Beep beep beep beep beep, boop! (Need beeping code) Pin
Rajesh R Subramanian10-Jul-06 2:46
professionalRajesh R Subramanian10-Jul-06 2:46 
GeneralRe: Beep beep beep beep beep, boop! (Need beeping code) Pin
Lord Kixdemp10-Jul-06 16:04
Lord Kixdemp10-Jul-06 16:04 
QuestionDLL can be truly used across linkers? Pin
George_George3-Jul-06 17:28
George_George3-Jul-06 17:28 
AnswerRe: DLL can be truly used across linkers? Pin
earl3-Jul-06 18:01
earl3-Jul-06 18:01 
GeneralRe: DLL can be truly used across linkers? Pin
George_George3-Jul-06 19:36
George_George3-Jul-06 19:36 
GeneralRe: DLL can be truly used across linkers? Pin
earl3-Jul-06 20:14
earl3-Jul-06 20:14 
GeneralRe: DLL can be truly used across linkers? Pin
George_George3-Jul-06 20:44
George_George3-Jul-06 20:44 
GeneralRe: DLL can be truly used across linkers? Pin
earl4-Jul-06 5:57
earl4-Jul-06 5:57 
George, there are a variety of calling conventions supported by the x86 platform and the visual studio compiler; it doesn't really matter which you use as long as you are consistent. Because the caller and callee have to agree, MS picked one of them (cdecl, thiscall, stdcall, fastcall) for DLLs and ran with it (__stdcall if I remember correctly).

Here is a dll ordinal table from a random dll from windows\system32

C:\WINDOWS\SYSTEM32>dumpbin /exports oemdspif.dll
Microsoft (R) COFF/PE Dumper Version 7.00.9466
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file oemdspif.dll

File Type: DLL

  Section contains the following exports for oemdspif.dll

    00000000 characteristics
    437413A2 time date stamp Thu Nov 10 21:44:34 2005
        0.00 version
           1 ordinal base
          24 number of functions
          24 number of names

    ordinal hint RVA      name

         18    0 00005090 GetCRTCCapabilities
         19    1 00005160 GetCRTCConfiguration
          2    2 00006090 GetDisplayDeviceCapability
          4    3 00003DE0 GetDisplayDeviceMode
          3    4 00003CD0 GetDisplayDeviceSwitchCapability
          1    5 000036F0 GetDisplayDriverName
         21    6 000057C0 GetExtendedDesktopStatus
         23    7 00006520 GetLCDI2CBusData
          9    8 000047F0 GetLCDRefreshRate
          8    9 000046F0 GetLCDRefreshRateCapability
         12    A 000061E0 GetPowerState
          6    B 000044B0 GetScreenExpansionStatus
         16    C 00004EA0 GetStaticPowerState
         14    D 00004AC0 GetTVStandard
         11    E 000049C0 IsExternalDisplayConnected
         20    F 00005300 SetCRTCConfiguration
          5   10 00003F40 SetDisplayDeviceMode
         22   11 00005850 SetExtendedDesktopStatus
         24   12 00006600 SetLCDI2CBusData
         10   13 000048E0 SetLCDRefreshRate
         13   14 00006360 SetPowerState
          7   15 000045D0 SetScreenExpansionStatus
         17   16 00004F90 SetStaticPowerState
         15   17 00004C70 SetTVStandard

  Summary

        2000 .data
        2000 .rdata
        1000 .reloc
        1000 .rsrc
        C000 .text

C:\WINDOWS\SYSTEM32>


dumpbin comes with most versions of visual studio; it should also be available somewhere online, though VC2005 Express is free. The RVA is probably some sort of relocatable address or some such; there are obviously some complications to "just load code into memory and run it", but they're just details. This is just an ordinal table generated so the linker / runtime can figure out where functions are in the dll.

As for C, this is pretty much the standard way (on win32) to express the lookup table, etc. C++ presents other issues (name mangling, memory management, etc), which is why we have COM, as well as the desire for things like interfaces, etc.

But yeah, this C calling convention is spoken by just about everything on windows -- VB, Python, probably perl, etc.

Hope this helps

earl
GeneralRe: DLL can be truly used across linkers? [modified] Pin
George_George4-Jul-06 22:31
George_George4-Jul-06 22:31 
GeneralRe: DLL can be truly used across linkers? Pin
earl5-Jul-06 3:27
earl5-Jul-06 3:27 
GeneralRe: DLL can be truly used across linkers? Pin
George_George5-Jul-06 22:20
George_George5-Jul-06 22:20 
GeneralRe: DLL can be truly used across linkers? Pin
earl6-Jul-06 8:42
earl6-Jul-06 8:42 
GeneralRe: DLL can be truly used across linkers? Pin
George_George10-Jul-06 2:07
George_George10-Jul-06 2:07 
QuestionDisplaying image using array.... Pin
we3Guy3-Jul-06 17:16
we3Guy3-Jul-06 17:16 
AnswerRe: Displaying image using array.... Pin
earl3-Jul-06 18:02
earl3-Jul-06 18:02 
AnswerRe: Displaying image using array.... Pin
Hamid_RT3-Jul-06 18:21
Hamid_RT3-Jul-06 18:21 
Questionserial communication Pin
thathvamsi3-Jul-06 17:04
thathvamsi3-Jul-06 17:04 
AnswerRe: serial communication [modified] Pin
earl3-Jul-06 17:54
earl3-Jul-06 17:54 
AnswerRe: serial communication Pin
Rilhas9-Jul-06 5:19
Rilhas9-Jul-06 5:19 
QuestionStdAfx questions Pin
Super Lloyd3-Jul-06 17:04
Super Lloyd3-Jul-06 17:04 
AnswerRe: StdAfx questions Pin
Michael Dunn3-Jul-06 17:10
sitebuilderMichael Dunn3-Jul-06 17:10 
GeneralRe: StdAfx questions Pin
Super Lloyd3-Jul-06 18:32
Super Lloyd3-Jul-06 18:32 
AnswerRe: StdAfx questions Pin
Saurabh.Garg3-Jul-06 20:58
Saurabh.Garg3-Jul-06 20:58 
GeneralRe: StdAfx questions Pin
Super Lloyd3-Jul-06 21:07
Super Lloyd3-Jul-06 21:07 
QuestionProblem with GetProcAddress Pin
RedDragon2k3-Jul-06 16:39
RedDragon2k3-Jul-06 16:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.