Board index » delphi » Pointer to a function or call a function inside EXE from a DLL

Pointer to a function or call a function inside EXE from a DLL

I have a DLL and an EXE
Inside the EXE is a function, lets say "DoSomething( int i1, int i2)".
Now I want to call this function from the DLL.
how to do, any idea?

best regards
Martin

 

Re:Pointer to a function or call a function inside EXE from a DLL


Export the function from the EXE, let the DLL do a GetModuleHandle or
LoadModule to get a module handle for the EXE, and have it use
GetProcAddress to get the function address and call it.

The details of how that would be done depend upon what kind of program, a 16
bit Windows program or a 32 bit Windows one.

.  Ed

Quote
> I have a DLL and an EXE
> Inside the EXE is a function, lets say
> "DoSomething( int i1, int i2)".
> Now I want to call this function from the DLL.
> how to do, any idea?

Re:Pointer to a function or call a function inside EXE from a DLL


Quote
> I use BCB6.

Wrong newsgroup.  This is borland.public.cpp.borlandcpp and you can see by
the name that it is where the Borland C++ compiler is handled.  C++ Builder
groups have the word 'cppbuilder' in their name.  For instance:

  borland.public.cppbuilder.ide
  borland.public.cppbuilder.nativeapi

.  Ed

Other Threads