1. using a dll from FPC

hi,

i made a dll with the fpc (free pascal) compiler. it ist not possible to use open_dll on it - I am using Phix. Any ideas?

new topic     » topic index » view message » categorize

2. Re: using a dll from FPC

begin said...

hi,

i made a dll with the fpc (free pascal) compiler. it ist not possible to use open_dll on it - I am using Phix. Any ideas?

I thought Euphoria/Phix could only open DLLs made from C? Though being able to read DLLs from other languages could be possible.

new topic     » goto parent     » topic index » view message » categorize

3. Re: using a dll from FPC

hi,

it should be possible for x64!

I use a lot of dlls from fortran and pascal. GCC(MING) and FPC/Delphi use a different way of generating libs and dlls. That should definitely work in EU/Phix, but not because I use that. I would hate to write a layer for a FPC/Delphi/Fortran dlls in C/C++ to add additional time to and more code to something that should be easily possible. BTW i made a minimal layer for VS22, AWD Modula and PB to see if that DLL works correctly - it does. With Pelles tools, it is easily possible to generate libs and here also.

br Richard

new topic     » goto parent     » topic index » view message » categorize

4. Re: using a dll from FPC

Probably 32/64 bit. Use demo/pGUI/filedump.exw to open the dll you made and check on the "PE Header" tab which it is.
Obviously you can also run p[w].exe without any params to see what that is as well.

Should it not be that simple, or filedump don't play nice with it, upload the dll somewhere and I'll have a bash at it.

new topic     » goto parent     » topic index » view message » categorize

5. Re: using a dll from FPC

Hi Pete, thanx for having a stab at it. this sounds stupid, but I am trying to port most of my stuff, that I use regulary, to be able to work with phix. I just love it.

Here the nums:

Phix: 
Version 1.0.1 (64 bit Windows) Copyright Pete Lomax 2006..2016 
 
DLL - made with Pascal - Lazarus (x64): 
64 Bit 
 
00000080 signature                     x4 PE\0\0          (should be "PE\0\0") 
00000084 machine                       h2 8664h           amd64 
00000086 sections                      2  9               Number of sections 
00000088 Date TimeStamp                h4 00000000h       Jan 1st 1970 00:00:00 
0000008( PointerToSymbolTable          h4 00000000h 
00000090 NumberOfSymbols               h4 00000000h 
00000094 SizeOfOptionalHeader          h2 OOFOh 
00000096 Characteristics               h2 222eh           EXEC+DLL-LINES?-DEBUG+LARGE_ADDR 
00000098 Magic                         h2 0208h           64bit 
0000009A MajorUnkerVersion             hl 03h             3.20 
00000098 MinorlinkerVersion            hl 14h 
0000009A SizeOfCode                    h4 000324D0h 
000000AO SizeOflnitializedData         h4 00003064h 
000000A4 SizeOfUninitializedOata       h4 00004FD8h 
000000A8 AddressOfEntryPoint           h4 00001C10h 
000000AC 8aseOfCode                    h4 00001000h 
00000080 lmageBase                     h8 110000000h 
00000088 SectionAlignment              h4 00001000h 
000000BC FileAlignment                 h4 00000200h 
000000C0 MajorOperating.SystemVersion  h2 0004h          4.0 
000000C2 MinorOperatingSystemVersion   h2 0000h 
000000C4 MajorlmageVersion             h2 0001h          1.0 
000000C6 MinorlmageVersion             h2 0000h 
000000C8 MajorSubsystemVersion         h2 0004h          4.0 
000000CA MinorSubsystemVersion         h2 0000h 
000000CC Win32VersionValue             h4 00000000h 
000000DO SizeOflmage                   h4 00059000h 
000000D4 SizeOfHeaders                 h4 00000400h 
000000D8 CheckSum                      h4 00000000h 
000000DC Subsystem                     h2 0003h          console app 
000000DE DIICharacteristics            h2 0000h 
000000EO SizeOf.StackReserve           h8 1000000h 
000000E8 SizeOfStackCommit             h8 1000h 
000000FO SizeOfHeapReserve             h8 100000h 
000000F8 SizeOfHeapCommit              h8 1000h 
00000100 LoaderFlags                   h4 00000000h 
00000104 NumberOfRvaAndSizes           4 16 
 
new topic     » goto parent     » topic index » view message » categorize

6. Re: using a dll from FPC

Doesn't seem to be anything wrong with that. If you upload the file (to eg Smash) and post a link here, I'll take a look.

new topic     » goto parent     » topic index » view message » categorize

7. Re: using a dll from FPC

thats very kind of you.

https://fromsmash.com/eugraphix

i just started to try to get it working and check the binding, but it will not load the dll.

new topic     » goto parent     » topic index » view message » categorize

8. Re: using a dll from FPC

That dll is dependent on fpcmemdll.dll which I don't have so can't ever open here.

Try and find that and put (the right 32/64 bit version) alongside wingraph12.dll - if it works, you'll have to
a) distribute it, and b) do something along the lines of demo/pGUI/win(32|64) that pGUI.e does, ie chdir()
to the appropriate subdirectory and back to a previously saved current_dir() around the open_dll(), or maybe
c) put a 64bit fpcmemdll.dll in Windows/System32 and a 32bit fpcmemdll.dll in Windows/SysWOW64 (yes, that way round), or
d) put (say) requires(64) at the top of your app/lib and that way force the issue so you only need one fpcmemdll.dll, or
e) do something with the path settings, probably best speak to someone on the fpc forums about that.
I just got 36 hits from google for "fpcmemdll.dll" and one of those might prove enlightening, not that I read any of them.

new topic     » goto parent     » topic index » view message » categorize

9. Re: using a dll from FPC

Hi Pete,

thanx for your hints and helps. Seams like, that fpc code as a DLL doesn't work with C or any other language as a dll, when being called - functions are exported, but are not callable. So now I am rewriting the whole shabang in C and that starts to work nicely. As soon as I have going for public consumption I'll post it with src. I am shooting for BGI with scrolling windows and full screen mode. The latter I have still to implement.

Please keep your good work comming -

you all have a nice, happy and prosperous new year

Richard

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu