For Programmers: Free Programming Magazines  


Home > Archive > Clarion > August 2006 > Unresolved external linking to a Delphi DLL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Unresolved external linking to a Delphi DLL
Oscar Janson :: Modest Automatisering BV

2006-08-30, 6:55 pm

Hello everyone,

I'm trying to hook up a very simple DLL which contains just one
function and I can't seem to get rid of Unresolved external error
messages. The DLL is written in Delphi.
This is my code for the DLL:

---------------------
library GetUnc;

uses
SysUtils;

function GetUncFromPath(path : string):string;
begin
Result := ExpandUNCFileName(path);
end;

exports
GetUncFromPath;

{$R *.res}
begin
end.

---------------------

Like real simple, only a few lines of code.

I try to link it to another DLL written in Clarion. In the main
module I define my DLL and the used function inside the
global MAP as follows:

-----------------------
! MODULE('GetUNC.LIB')
MODULE('GETUNC.DLL')
GetUncFromPath FUNCTION(STRING), STRING, DLL, PASCAL,
NAME('GetUncFromPath')
END
-----------------------

As you can see (or not) by my commented out module declaration
of the LIB, I've tried using the program LibMaker to link LIBwise
instead first, like it says in the Clarion help files.

This is the message I get:
Unresolved External GetUncFromPath in mdfun028.obj

So. Anyone any idea what I might have been missing?

Thanks in advance.

Yours sincerely,
Oscar Janson
Modest Automatisering B.V.

clackmannan

2006-08-30, 6:55 pm


Oscar Janson :: Modest Automatisering BV wrote:
> Hello everyone,
>

<snip>
>
> This is the message I get:
> Unresolved External GetUncFromPath in mdfun028.obj
>
> So. Anyone any idea what I might have been missing?
>


It's normally a 2 part process
1) Run Libmaker on the Delphi DLL and make a new .lib file
2) Then add the .lib file into the project (otherwise the linker won't
link the exe to the dll)

Since you didn't mention step 2 I'm guessing you either forgot, or
didn't know, you had to do it

Paul

Oscar Janson :: Modest Automatisering BV

2006-08-31, 3:55 am

clackmannan wrote:

> It's normally a 2 part process
> 1) Run Libmaker on the Delphi DLL and make a new .lib file
> 2) Then add the .lib file into the project (otherwise the linker won't
> link the exe to the dll)
>
> Since you didn't mention step 2 I'm guessing you either forgot, or
> didn't know, you had to do it


Indeed, I ran Libmaker first, and I assumed step 2 was simply
including the lib file in the global MAP. I don't normally link
non-clarion DLL's, and when I do, I do so via the insert module
option, so my confusion was understandable. The other DLL
compiles fine now, the main executable still launches, all the
other functions in the Clarion DLL work just fine, except that
when I try to use the Delphi function somewhere, the program
crashes without any explanation of what went wrong.
Thanks for the tip and your time anyway :)

Yours sincerely,
Oscar Janson
Modest Automatisering BV

clackmannan

2006-08-31, 6:55 pm

> The other DLL
> compiles fine now, the main executable still launches, all the
> other functions in the Clarion DLL work just fine, except that
> when I try to use the Delphi function somewhere, the program
> crashes without any explanation of what went wrong.


Check the type definition of the parameters. A Clarion string is not
the same as a Pascal string or a C string.

Paul

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com