?
Solved

Unresolved external in BC 5.01

Posted on 1997-02-18
7
Medium Priority
?
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
chedrick earned 200 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

765 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