Solved

Unresolved external in BC 5.01

Posted on 1997-02-18
7
240 Views
Last Modified: 2013-12-04
I'm trying to convert a 16-bit dll to 32-bit. The dll uses an ojbect file that I created using MASM 6.11c. I compiled the ASM file and have a new 32-bit .OBJ file. It compiled with no errors. The relevent part of the ASM file follows:

.386
.model flat, stdcall      
.CODE
M250    PROC   NEAR COMMAND:DWORD, L_RESPONSE:DWORD, RET_ERROR:DWORD

In the header file for the dll, I have the following line to define the prototype for M250:

extern "C"
{
  BOOL __stdcall M250(short *command, long *response, short
*errorCode);
}

The TargetExpert options are Platform:Win32 and Target Model: Console.

And the IDE project looks like this:

250dll32 {.dll]
   |
   250dlld [.cpp]
   |
   |--250dll [.h]
   |
   M250_32  [.obj]
   |
   default  [.def]


When I attempt to build the dll. I get the following message

Info :Building...
Info :Compiling C:\Model250\250ewin\version5\32bit\250dlld.cpp
Info :Linking C:\Model250\250ewin\version5\32bit\250dll32.dll
Warn :  Warning: .DEF file heap reserve size < 64K; 1MB default will be used
Warn :  Warning: .DEF file stack reserve size < 64K; 1MB default will be used
Error:  Error: Unresolved external 'M250' referenced from module 250dlld.cpp

What am I doing wrong? The project compiles and runs fine when I built it for 16-bit.
0
Comment
Question by:SeanR
  • 5
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
chedrick earned 100 total points
Comment Utility
Drop the NEAR....

Chuck
0
 

Author Comment

by:SeanR
Comment Utility
I dropped the NEAR. No change, still unresolved external 'M250'.
0
 
LVL 1

Expert Comment

by:chedrick
Comment Utility
Opps, I answer so many of these sometimes I forget and submit an incomplete answer. Sorry about that {:-)
In Win32 a short is two bytes and a long is four The compiler is trying to resolve a M250 with a short int, a long and another short int as arguments. You function has DWORD,DWORD,DWORD.
Adjust one or the other to match and this should go away (the key work here is should...)
If not, let me know...

Happy linkin'
Chuck
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:chedrick
Comment Utility
Any by the way... pointers (like those your function uses) are 32 bit addresses (that 4 bytes to you and me) so try changing the prototype to
M250(DWORD command, DWORD response, DWORD *errorCode);
and see if it resolves. If so the problem is definitely in the declaration.

0
 
LVL 1

Expert Comment

by:chedrick
Comment Utility
That declaration should end with DWORD errorCode);
NOT
DWORD *errorCode);
Sorry, too much tube time...

Chuck
0
 
LVL 1

Expert Comment

by:chedrick
Comment Utility
Sean,
One final suggestion...
I typically use WINAPI (the same as FAR PASCAL) for exported DLL functions in Win32. I don't *think* this is the problem but if the above suggestions fail, try it.

Chuck...
0
 

Author Comment

by:SeanR
Comment Utility
Sorry for the delay, I've been working on another project.
I have tried the suggestions given above, and I still get "unresolved external 'M250'". Could someone give me an example of a MASM assembly function that takes three arguments by reference in 32-bit code, and the calling declaration in C for Borland C++ 5.01?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video discusses moving either the default database or any database to a new volume.

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

11 Experts available now in Live!

Get 1:1 Help Now