* * *

Author Topic: Can't find unit Test.dll used by XXX  (Read 604 times)

ortodox

  • Newbie
  • Posts: 3
Can't find unit Test.dll used by XXX
« on: May 08, 2018, 07:49:17 pm »
Hi.

I try to compile object pascal sources and i get error "Can't find unit Test.dll used by XXX"

I compile object pascal sources in command line uses free pascal compiler like this": fpc XXX -dCLR -MOBJFPC -Fu"PATH\References\".
DLL library is in "References" directory above and dll library is in sources under "uses" statement like this:

Code: Pascal  [Select]
  1. uses
  2. {$IFNDEF CLR}
  3.   aaa, bbb, ccc,
  4. {$ELSE}
  5.   Test
  6.  

Whats wrong?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6242
Re: Can't find unit Test.dll used by XXX
« Reply #1 on: May 08, 2018, 07:53:48 pm »
You do realize that there are two kinds of DLL. Clr DLL and real DLL?

FPC only interfaces to real DLLs, and not .NET assemblies, aka .NET/CLR DLLs ?

ortodox

  • Newbie
  • Posts: 3
Re: Can't find unit Test.dll used by XXX
« Reply #2 on: May 08, 2018, 08:27:48 pm »
Two kinds of DLL?

I have never heard of it.
Do you have some materials to it?
I found https://cs.wikipedia.org/wiki/DLL but this is .net DLL.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6242
Re: Can't find unit Test.dll used by XXX
« Reply #3 on: May 08, 2018, 08:49:33 pm »
Two kinds of DLL?

I have never heard of it.
Do you have some materials to it?
I found https://cs.wikipedia.org/wiki/DLL but this is .net DLL.

The english version of that:

vs https://en.wikipedia.org/wiki/Dynamic-link_library#Delphi

(note the Delphi paragraph, that is similar to FPC)

the .NET implementation: https://en.wikipedia.org/wiki/Assembly_(CLI)

which is something totally different. This will need to be approached over COM interop in FPC

ortodox

  • Newbie
  • Posts: 3
Re: Can't find unit Test.dll used by XXX
« Reply #4 on: May 08, 2018, 09:59:40 pm »
Quote
This will need to be approached over COM interop in FPC

Can I this resolved? If I undestand right? With COM interop....Do you have some documentation of this please? I found nothing.
Or it could be possible convert .net dll to normal .dll?

I understand right that normal .dll is win32/com .dll library?

Thank you.

Thaddy

  • Hero Member
  • *****
  • Posts: 6130
Re: Can't find unit Test.dll used by XXX
« Reply #5 on: May 09, 2018, 07:11:02 am »
fpc XXX -dCLR -MOBJFPC -Fu"PATH\References\". ???
Options first, please:
fpc -dCLR -MOBJFPC -Fu"PATH\References\" XXX

Also note CLR seems to be defined somewhere in your code. It looks like it shouldn't.
Code: Pascal  [Select]
  1. {$if defined(CLR)}{$UNDEF CLR}{$ifend}
Before the other defines..will use aaa,bbb,ccc instead of test.
Better look up where CLR is defined...and comment it out. But this will also work.
« Last Edit: May 09, 2018, 07:32:41 am by Thaddy »
I might not give the answer that you want me to.. Peter Green 1969

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6242
Re: Can't find unit Test.dll used by XXX
« Reply #6 on: May 09, 2018, 08:10:37 am »
Quote
This will need to be approached over COM interop in FPC

Can I this resolved?

I don't know if it is always possible (if there are .NET assemblies that can't be interfaced from Delphi/FPC easily).

Quote
If I undestand right? With COM interop....Do you have some documentation of this please? I found nothing.

Strange. When I put "com interop" in google, I get pages of stuff.

It is the way all .NET code interfaces with native win32 or win64 code. Delphi and FPC just have some ways of make that easier (like the ability to define COM compatible interfaces)

Documentation is Microsoft for the general .NET->native case, and look for Delphi and COM for some more specific info.

I just needed to know enough to avoid .NET only software products, never done it myself.

Quote
Or it could be possible convert .net dll to normal .dll?

Not that I know. At best you can generate some DLL that talks to .NET which then (should) loads the .NET assembly DLL internally

Quote
I understand right that normal .dll is win32/com .dll library?

Normal dll is win32. Some dlls might also contain COM.  .NET is COM based internally, but piles extra layers on top.

As said the subject to look for is .NET<->COM interop to get the fundamental concepts, and then general Delphi (and thus FPC/Lazarus) ways to connect to COM. 

I never done it myself, so can only give you general pointers like https://stackoverflow.com/questions/16785357/how-to-call-net-from-delphi  (found with Delphi call .net)
« Last Edit: May 09, 2018, 08:20:18 am by marcov »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus