Solved

Unresolved external in BC 5.01

Posted on 1997-02-18
7
241 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
ID: 1300026
Drop the NEAR....

Chuck
0
 

Author Comment

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

Expert Comment

by:chedrick
ID: 1300028
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:chedrick
ID: 1300029
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
ID: 1300030
That declaration should end with DWORD errorCode);
NOT
DWORD *errorCode);
Sorry, too much tube time...

Chuck
0
 
LVL 1

Expert Comment

by:chedrick
ID: 1300031
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
ID: 1300032
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

20 Experts available now in Live!

Get 1:1 Help Now