Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C++ Def and Non-Def file - Function Signature - help!

C++ Def and Non-Def file - Function Signature - help!

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helpcsharpvisual-studio
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chua Wen Ching
    wrote on last edited by
    #1

    Hi there, I had a question. I just noticed the availability of module definition file *.def. I had a few doubts. The current scenario: ------------------------- *The wrapper dll's library and dll is place under the SDK folder. The lib file is included in the project under the visual studio path settings. SDK -> Wrapper Dll SDK code: ------------- #include "wrapper_dll.h" extern "C" __declspec(dllimport) double TestA(double a, double b); Wrapper DLL Code: ------------------------ #define extern "C __declspec(dllexport) EXTERN double WINAPI TestA(double a, double b); When you built in into a dll, when you view the dll dependecies, you will notice this (example): Ordinal = 1 (0x0001) Hint = 0 (0x0000) Function = _TestA@20 EntryPoint = 0x0000101E *The build dll, lib and header file is past to the SDK team to call it. ============================================================ Now, I want to implement def file: SDK (cannot modified, coz done by someone else and different team) but it still calls the Wrapper dll. SDK code (same with on top): ----------------------------------- #include "wrapper_dll.h" extern "C" __declspec(dllimport) double TestA(double a, double b); New Wrapper Dll code: --------------------------- wrapper_dll.cpp: double TestA(double a, double b) { return a + b / 10; } wrapper_dll.h: #pragma once // what does pragma means anyway?? any idea??? double TestA(double a, double b); wrapper_dll.def: LIBRARY Wrapper_Dll EXPORTS TestA Now, when i view this dll dependencies, it appears to be like this: Ordinal = 1 (0x0001) Hint = 0 (0x0000) Function = TestA EntryPoint = 0x000128A7 *problem is the Function name is changed, entrypoint number is change... will this cause problem for the SDK when calling. ============================================================ I need to make sure SDK should be recompiled. I just have to replace the new wrapper dll, lib and .h into the existing files that is part of the SDK folder. Should i be using def or not def? The current old code is using no def file. Means the sdk will have __declspec(dllimport) and the wrapper will have __declspec(dllexport), and the #include "Wrapper_dll.h" is still part of it of the sdk. Please help! Module definition file is indeed easier for us as a coder to code. But i just want to see what is the advantages of using def over the others. Thanks. Regards, Chua Wen Ching :p

    V 1 Reply Last reply
    0
    • C Chua Wen Ching

      Hi there, I had a question. I just noticed the availability of module definition file *.def. I had a few doubts. The current scenario: ------------------------- *The wrapper dll's library and dll is place under the SDK folder. The lib file is included in the project under the visual studio path settings. SDK -> Wrapper Dll SDK code: ------------- #include "wrapper_dll.h" extern "C" __declspec(dllimport) double TestA(double a, double b); Wrapper DLL Code: ------------------------ #define extern "C __declspec(dllexport) EXTERN double WINAPI TestA(double a, double b); When you built in into a dll, when you view the dll dependecies, you will notice this (example): Ordinal = 1 (0x0001) Hint = 0 (0x0000) Function = _TestA@20 EntryPoint = 0x0000101E *The build dll, lib and header file is past to the SDK team to call it. ============================================================ Now, I want to implement def file: SDK (cannot modified, coz done by someone else and different team) but it still calls the Wrapper dll. SDK code (same with on top): ----------------------------------- #include "wrapper_dll.h" extern "C" __declspec(dllimport) double TestA(double a, double b); New Wrapper Dll code: --------------------------- wrapper_dll.cpp: double TestA(double a, double b) { return a + b / 10; } wrapper_dll.h: #pragma once // what does pragma means anyway?? any idea??? double TestA(double a, double b); wrapper_dll.def: LIBRARY Wrapper_Dll EXPORTS TestA Now, when i view this dll dependencies, it appears to be like this: Ordinal = 1 (0x0001) Hint = 0 (0x0000) Function = TestA EntryPoint = 0x000128A7 *problem is the Function name is changed, entrypoint number is change... will this cause problem for the SDK when calling. ============================================================ I need to make sure SDK should be recompiled. I just have to replace the new wrapper dll, lib and .h into the existing files that is part of the SDK folder. Should i be using def or not def? The current old code is using no def file. Means the sdk will have __declspec(dllimport) and the wrapper will have __declspec(dllexport), and the #include "Wrapper_dll.h" is still part of it of the sdk. Please help! Module definition file is indeed easier for us as a coder to code. But i just want to see what is the advantages of using def over the others. Thanks. Regards, Chua Wen Ching :p

      V Offline
      V Offline
      vmaltsev
      wrote on last edited by
      #2

      Hail again, If you provide .dll, .lib and .h that means you link to a DLL implicitly and you don't need .def file then. Using a module definition file makes sense only if you want to find function entry point during run-time by using GetProcAddress and referencing a function by an ordinal rather than a name.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups