Menu

Another topic on DLL problems

2002-10-24
2012-09-26
  • Nobody/Anonymous

    I have tried to create a DLL using Dev-cpps DLL template

    my dllmain.cpp reads
    ---------
    #include <windows.h>
    #include "patch.h"
    #ifndef DLLEXPORT
    #define DLLEXPORT __declspec (dllexport)
    #endif

    //Export List
    DLLEXPORT int addpatchdata(const char patchfile[],
                     const char sourcefile[],
                        long int lowerb,
                      long int upperb);
                     
    DLLEXPORT int createpatchfile(const char *ccfilename);

    DLLEXPORT int patchfile(char patchfile[],char targetfile[]);
    --------

    and my DEF file looks like this

    --------
    LIBRARY "patch.dll"

    EXPORTS
    patchfile
    createpatchfile
    addpatchdata
    -----

    when i attempt to compile it, there is an error, even though the DLL compiles, it appears that the funcitons are not exported

    compile log
    --------------------
    Building Makefile: "C:\Dev-Cpp\Dan\Filemend\Makefile.win"
    Finding dependencies for file: C:\Dev-Cpp\Dan\Filemend\..\..\Templates\dllmain.cpp
    Executing  make...
    make.exe -f "C:\Dev-Cpp\Dan\Filemend\Makefile.win" all
    dllwrap.exe --output-def libpatch.def --driver-name c++ --implib libpatch.a ../Filemend/dllmain.o  -L"C:/DEV-CPP/lib" -L"C:/Dev-Cpp/Dan/Filemend" --no-export-all-symbols --add-stdcall-alias -lgmon -o patch.dll

    C:\DEV-CPP\BIN\DLLWRAP.EXE: no export definition file provided

    C:\DEV-CPP\BIN\DLLWRAP.EXE: creating one, but that may not be what you want

    Execution terminated
    Compilation successful
    ---

    then i add the option --def
    patch.def

    and the following compile log results
    ------------------
    Building Makefile: "C:\Dev-Cpp\Dan\Filemend\Makefile.win"
    Finding dependencies for file: C:\Dev-Cpp\Dan\Filemend\..\..\Templates\dllmain.cpp
    Executing  make...
    make.exe -f "C:\Dev-Cpp\Dan\Filemend\Makefile.win" all
    g++.exe -c ../../Templates/dllmain.cpp -o ../Filemend/dllmain.o -I"C:/DEV-CPP/include"  -I"C:/DEV-CPP/include/g++-3"  -I"C:/DEV-CPP/include"  -I"C:/Dev-Cpp/Dan/Include"  -I"C:/Master Code/CPP"  -I"C:/Dev-Cpp/Dan/Filemend"  -DBUILDING_DLL=1 -fsave-memoized -pg -s -O3 -fexpensive-optimizations

    dllwrap.exe --output-def libpatch.def --driver-name c++ --implib libpatch.a ../Filemend/dllmain.o  -L"C:/DEV-CPP/lib" -L"C:/Dev-Cpp/Dan/Filemend" --no-export-all-symbols --add-stdcall-alias -lgmon --def patch.def -o patch.dll

    patch.exp(.edata+0x34):fake: undefined reference to `createpatchfile'
    patch.exp(.edata+0x38):fake: undefined reference to `patchfile'
    patch.exp(.edata+0x3c):fake: undefined reference to `addpatchdata'

    C:\DEV-CPP\BIN\DLLWRAP.EXE: c++ exited with status 1

    Execution terminated

    ----

    i went through the forum and tried various ideas, having written the DEF file myself, as it was not generated by the DLL template.

    any ideas would be appreciated, ive been browsing the web nonstop for hours for a solution.

     
    • Nobody/Anonymous

      I don't know about GCC but when using MSVC and writing a .DEF file the exported functions were of the format

      FunctionOne       @1
      FunctionTwo       @2

      .. and so on. Each digit ID must be unique.

      Geoff

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.