VC6 DLL loaded from nonvc6 main.exe 
Author Message
 VC6 DLL loaded from nonvc6 main.exe

Hello,

i have a DLL with a single exported function with _stdcall linkage.

note: _Export is defined to be declspec, and _system is stdcall.

here is the function header:

extern "C"
{
 typedef int _System fooFactory2(int par1,int par2, int par3,int par4);
 typedef fooFactory2 * fooFactoryPtr2;
 fooFactory2 _Export fooFactoryFun2;

Quote:
}

and here the impl.

#include <stdio.h>
#include <tst6.hpp>

int _Export _System fooFactoryFun2(int par1,int par2, int par3,int par4)
{
 printf("Fun2: p1=%d,p2=%d,p3=%d,p4=%d\n",par1,par2,par3,par4);
 return par1+par2+par3+par4;

Quote:
}

so far, so good. i have a main while loads the DLL (dynamic!) and queries
for the fuinction "fooFactoryFun2". then it calls the function with 1,2,3,4.

i compile the DLL with MSVC++.

when i compile this simple main with MSVC++ and run it, i see the printf
output, and then 10 is returned. ok.
then  i compile the main with IBM VACPP 3.5.7. : i see NO printf output, and
10 is returned. (the function is entered - when i do a simple beeps, i here
the beep).

when i compile the DLL with IBM VACPP then everythings works fine with both
dlls.
so:

main_ibm + dll_ibm  : rc=10, printfs ok
main_ibm + dll_vc    : rc=10, no printfs
main_vc   + dll_ibm  : rc=10, printfs ok
main_vc   + dll_vc    : rc=10, printfs ok

why does the VC++ generated dll does not printf anything when the main is
vacppp compiled?

--
regards, Mario Semo. http://www.*-*-*.com/



Tue, 30 Jul 2002 03:00:00 GMT  
 VC6 DLL loaded from nonvc6 main.exe
On Fri, 11 Feb 2000 11:38:45 +0100, "Mario Semo"

Quote:

>why does the VC++ generated dll does not printf anything when the main is
>vacppp compiled?

Do you have the library source code?  Could be
"printf" is redefined to some other function depending
on some #define or system setting.  Why it goes in
the bit bucket I don't know.  If you're really curious
try turing the VC++ dll into an InProc COM Server
and see it that works with the IBM main. :)

Mike

--

"Genius gives birth, talent delivers."

           -- Jack Kerouac

(Remove NOSPAM, if present, to reply via email)



Wed, 31 Jul 2002 03:00:00 GMT  
 VC6 DLL loaded from nonvc6 main.exe
Hello,

a) i dont have the lib source. is MSvc++ lib source still avaible. (the last
MS C lib source i have is from MSC 60a OS2 + DOS compiler from 1990).
b) i've got it working. when i add a fflush(0) after the priontf, i see the
output. looks as there is a cacheing active, which confuses something.

--
regards, Mario Semo. http://www.kirchnersoft.com

Quote:

>On Fri, 11 Feb 2000 11:38:45 +0100, "Mario Semo"

>>why does the VC++ generated dll does not printf anything when the main is
>>vacppp compiled?



Fri, 02 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VC6: loading DLLs (linked LIB)

2. Help: Crash when loading MFC 4.2 dll's in VC6 app (Access violation)

3. Property page : Debug exe not working with Release DLL (vc6)

4. Loading native .dll in an exe process space

5. Load Icon from exe/dll

6. How to load an icon from EXE or DLL file

7. Loading EXE resources from a DLL

8. Debug VC6 exe launched from VB6 exe

9. loading an MFC DLL that was originally an extension dll from a non MFC dLL

10. MSLANGLOAD--error in loading module (Loading DLLs)

11. hanging in loading symbols in debugging DLL loaded by external App

12. VC6 DLL calls VB6 DLL calls back to VC6 DLL: Occasional GPF or ‘Bad DLL calling convention'

 

 
Powered by phpBB® Forum Software