Solved

Using a C-language API DLL

Posted on 1997-10-08
4
201 Views
Last Modified: 2006-11-17
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
Comment
Question by:achimala
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Srw
Comment Utility
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
 

Author Comment

by:achimala
Comment Utility
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
 
LVL 7

Accepted Solution

by:
faster earned 70 total points
Comment Utility
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
 
LVL 7

Expert Comment

by:faster
Comment Utility
By "windows console problem", I actually mean "windows console program".
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now