[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Using a C-language API DLL

Environment: Windows 95 and MS VC++ 1.52
I am trying to make a call to a function in a DLL (16-bit) and I keep getting the following Prog Error:
" Your program is making an invalid dynamic link call to a .DLL file"
I do have the .lib in the import libraries of the Linker Options, in the imports section of my .def file, and in the Directories Libraries path.

Following is my program:

#define ELOG_MODULENAME   "TEST"
#include <stdio.h>      /* needed for ELOGPUB.h */
#include <stdlib.h>
#include <string.h>
#include <rctpub.h>
#include <memory.h>
#include <malloc.h>
#include <windows.h>
#include <profpub.h>
#include <gtipub.h>
#include <actmpub.h>
#include <rctmsg.h>
#include <elogpub.h>
#include <rctxpub.h>
#include <fetixpub.h>  

int main ( int argc, char * argv[] )
{
   long lCoreSession   = 0;
   long lCoreConectRec = 0;  
   int  iRV            = 0;

   printf("Hello1\n");  
   
  /* RctXInitializeCORESession is the function that I have been trying to call, which is in a third-party DLL*/
   iRV = RctXInitializeCORESession( &lCoreSession,
                                    &lCoreConectRec,
                                    "RCTX_A",
                                    "FREDUSER",
                                    "" );  
   printf("Hello2\n");                                    
}

I would really appreciate any help in this matter. Thanks a million!!!
0
achimala
Asked:
achimala
  • 2
1 Solution
 
SrwCommented:
Do you get the error when you call RctX...(), or when you run the program?

Are you sure that the actual DLL being loaded is the 16-bit version?
0
 
achimalaAuthor Commented:
I am getting the error, when I run the .exe (which means, the .exe is being created with no errors!!!). And I am sure the DLL being loaded is a 16-bit version. Some of my friends suggested that I check whether the DLLs have been registered or not. I did run the regedit and searched for them, but couldn't find them there. Is this a problem?  
0
 
fasterCommented:
Your exe is windows console problem, but I remember that in VC 1.52, it does not support this yet. (probably there is noo 16 bit console program).  So your program is actually a DOS program and therefore can not use dll.

Try to create a normal windows program (which use WinMain instead of main()), and see whether it is successful.
0
 
fasterCommented:
By "windows console problem", I actually mean "windows console program".
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now