Exporting function from an .exe to be used by loaded .dll

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: ledZ (ledz_at_argz.com)
Date: 03/03/04


Date: 3 Mar 2004 08:43:22 -0800

I have the following design.

Build host appname.exe that exports some useful functions. When I
compile this, appname.lib is created with the exported files.

Create plugin dlls that link with appname.lib and are loaded at run
time by the host appname.exe using LoadLibrary(plugin_name). These
plugins can use all the functions exported by appname.exe.

I have this design coded and working flawlessly on Windows XP. Using
the same code base I then created my CE.net version in EVC4. When I
run appname.exe on CE (in the emulator - no hardware yet) the plugins
do not load and GetLastError() returns 193 - Bad EXE Format.

I can't figure out why this is happening.

As a test I created a simple .exe and simple .dll in EVC4. The exe
exports one function and the dll uses it.

The dll load failed with the same error but as soon as I remove the
exported function from the exe and its reference from the dll it loads
fine.

This design is critical to my application - any help is appreciated.



Relevant Pages

  • RE: Exporting function from an .exe to be used by loaded .dll
    ... CE will only load and resolve exports from a module with the IMAGE_FILE_DLL ... This design won't work under CE. ... > exports one function and the dll uses it. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Convert C-Builder program to Delphi?
    ... > quite separate from the function declaration itself. ... >this DLL ... >way the only place anything needs to be changed is in the #define macro. ... Exports SomeDLL_Open Name 'SomeDLL_Open'; ...
    (comp.lang.pascal.delphi.misc)
  • Re: Convert C-Builder program to Delphi?
    ... > quite separate from the function declaration itself. ... >this DLL ... >way the only place anything needs to be changed is in the #define macro. ... Exports SomeDLL_Open Name 'SomeDLL_Open'; ...
    (comp.lang.cpp)
  • Re: Export C++ class from a Borland DLL and use it in Microsoft VC
    ... Borland uses a different C runtime than Visual Studio. ... Of course, it is not impossible to use a DLL across compilers, even across different languages. ... You still need to use pure extern "C" exports, but the functions themselves can accept and return C++ classes. ... You must either not use enums in your interface, or modify Borland's compiler settings for your particular cpp file. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Export C++ class from a Borland DLL and use it in Microsoft VC
    ... Borland uses a different C runtime (including a different memory ... Use a C-style DLL. ... use pure extern "C" exports, but the functions themselves can accept and ... You must either not use enums in your interface, ...
    (microsoft.public.dotnet.languages.vc)