Solved

Unresolved external in BC 5.01

Posted on 1997-02-18
7
244 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 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

696 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