Re: Exporting function from EXE problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



No, I think that's Ok for me. Mainly I need to run this function from
ActiveX component which is actually DLL. Only for testing reasons I was
trying to call this function from EXE. but in this case I switch my testing
routine into DLL and envelop it into EXE. So I try it. Thank you all. I let
you know here in this thread if any problem. Thanks again!


"Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote in message
news:ua56m25ilific93nfkec46t7rutt4j1foh@xxxxxxxxxx
On Mon, 20 Nov 2006 15:48:05 +0100, "German Koninin"
<nomail@xxxxxxxxxxxxx>
wrote:

Good afternoon.
My problem is that I'm trying to export a function from my EXE.
LoadLibrary
and GetProcAddress wrks fine, but when I call function I'm getting access
violation error. I mean when function is empty or I have some simple code
there like int q = 0; it works fine, but when I initialize a class or
simple
call another function I'm getting access violation. It looks like exe is
not
loaded correctly in to caller's address space or something like that.
Could
you please help me to sort it out. The point is that I need exe with
exported function and need to be able to call that function from other exe
or dll by dynamic linking.

It won't work for the reasons given by Tom and Tim. However, a DLL loaded
into an EXE's process can GetProcAddress a function exported from the EXE
and call that function, though it usually makes more sense for the EXE to
pass information into the DLL directly.

--
Doug Harrison
Visual C++ MVP


.



Relevant Pages

  • Re: Editors
    ... some strip them on exe files by default. ... "preferred base address" and, yup, relocations are completely ... DLL files, though, aren't loaded into their own address space but are ... EXE's "entry-point", though, is not "special" in that it's just an ...
    (alt.lang.asm)
  • Re: new - delete issue
    ... EXE calls a DLL exported function that return a struct pointer. ... The EXE call another exported function that delete all pointers in that list. ...
    (microsoft.public.vc.mfc)
  • Re: DLL pass vector by value crash
    ... The prototype for testfunc is a by-value copy, so it has to make a copy of the value. ... Are you using static linking for either the .exe (if so, it probably won't work correctly, ... clearly using the shared CRT DLL for the DLL you are constructing. ... no crash occurs in either config. ...
    (microsoft.public.vc.mfc)
  • Re: DLL pass vector by value crash
    ... stack of the exe and may allocate default member element on the exe heap. ... If this is a dangerous situation, the simple app I set up calling testFunc() ... in a dll did not crash. ... msvcr90.dll!free and access the source code of free.c. ...
    (microsoft.public.vc.mfc)
  • Re: Using same interfaces for in-proc vs. out-proc
    ... for each server) might work better after all. ... TLB,>you reference it in VB and gain access to all ... both EXE and DLL versions must use the same source code; ...
    (microsoft.public.vc.atl)