May 15, 2024, 03:04:39 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


"Unresolved external" problem

Started by LarryMc, August 10, 2008, 11:01:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Working on a library.
During development my library code and a user's dialog that uses the library is all one src file...makes debug/fix easier.

Everything works like I want so it's time to strip out all the user stuff and create the static lib.

When I compile to a lib I get no errors.

I then take the code for the user's dialog and $include "mylib.inc" which has a $use "mylib.lib" in it

When I try to compile my program I get this:
QuoteCompiling...
GBLM_dev_testing.eba
No Errors

Linking...
Emergence Linker v1.11 Copyright ÂÃ,© 2006 Ionic Wind Software
Unresolved external __imp_GradientFill
Error: Unresolved extern __imp_GradientFill
Error(s) in linking C:\_EBDev\projects\Custom Controls\GradButtonLM\GBLM_dev_testing.exe
It's declared exactly the same in the library src file as it was in my debug src.
GradientFill is the only function I'm using that resides in the msing32.lib.

But since the code(declarations/includes) for that function were unchanged between between the debug code version and the lib version I can't see why it isn't working.

I've tried it using $include "windows.inc"(sapero's) and $use "msimg32.lib" and declaring it and I've also tried DECLARE "msimg32.dll",GradientFill(hdc:INT, PTRIVERTEX:PTRIVERTEX, ulong:INT, pvoid:POINTER, ulong:INT, ulong:INT),INT

None of them work when it is made into a lib.

But they work when it's all in one file(library code and user interface code) in one .exe file.

Any suggestions where to look.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

$use statements do nothing in a static libraries source code.  They have to be in your libraries include file that you give to the user.

In other words if you are providing blah.lib and blah.inc to the user, and the code for blah.lib requires XXX.lib then in your blah.inc source file you need

$use "XXX.lib"

The reason being is a static library isn't sent to the linker, it is a collection of object files stored in an archive, made by the AR archiver.  Those object files contain references that need to be resolved by the linker.  So it is not your linker that is resolving those references, it is the user of your library.

Thanks,
Paul.
Ionic Wind Support Team

LarryMc

Thanks for the explanation.
adding $use "msimg32.lib" did indeed get rid of the linking problem.

The exe, when run, just flashes the dialog and the program closes.

I seen this before when I was calling a custom class before I had registered it properly.

Pretty sure I know how to fix that.

Again, thanks for the explanation and help.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library