Recent

Author Topic: Trying to bind a C library  (Read 6429 times)

cdbc

  • Hero Member
  • *****
  • Posts: 1078
    • http://www.cdbc.dk
Re: Trying to bind a C library
« Reply #45 on: March 23, 2021, 11:22:51 pm »
Hi
I've learnt that what gets allocated in a library get freed in the library!
What you allocate in your program get freed in your program! Don't mix.
So as i see it, those memory functions are quite important, use them!
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

lumi

  • New Member
  • *
  • Posts: 17
Re: Trying to bind a C library
« Reply #46 on: March 24, 2021, 12:48:11 am »
Yes, it doesn't compile anyway..
Idk I can't find the right directory to include :-\

I might use the dll and call it a day cause it is getting frustrating, but I really wanted it to be statically linked

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Trying to bind a C library
« Reply #47 on: March 24, 2021, 01:09:10 am »
is "import library not found C" the only issue you're having?

lumi

  • New Member
  • *
  • Posts: 17
Re: Trying to bind a C library
« Reply #48 on: March 24, 2021, 01:20:10 am »
Quote
is "import library not found C" the only issue you're having?

Yes! I think so.
Right now I'm using the dll you provided yesterday until I try to make the static library work again. It works perfectly so thanks a lot for that :D

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Trying to bind a C library
« Reply #49 on: March 24, 2021, 01:26:32 am »
Right now I'm using the dll you provided yesterday until I try to make the static library work again. It works perfectly so thanks a lot for that :D
I was hoping I taught you to fish, instead of giving you one xD

let's try to make static the work for you.
Did you try to look for "libc" in your mingw installation? just search for the file itself. (it's likely to be named libc*.a)

lumi

  • New Member
  • *
  • Posts: 17
Re: Trying to bind a C library
« Reply #50 on: March 24, 2021, 01:42:54 am »
Quote
I was hoping I taught you to fish, instead of giving you one xD
I am probably going to bind more c library after. I am definitely going to revisit all the advices everyone gave when doing so.

Yes, I tried looking for it but I couldn't locate it in my mingw install


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Trying to bind a C library
« Reply #51 on: March 24, 2021, 03:59:53 am »
instead of trying to link to libC try the to link to the set of these libraries:
Code: Pascal  [Select][+][-]
  1. {$linklib ntdll}
  2. {$linklib mingwex}
  3. {$linklib mingw32}
  4. {$linklib msvcrt}
  5. {$linklib kernel32}
  6. {$linklib libgcc}

according to the build logs of make, only the following libraries are used for wren_test
Code: Text  [Select][+][-]
  1. -lm
  2. -lmingw32
  3. -lgcc
  4. -lgcc_eh
  5. -lmoldname
  6. -lmingwex
  7. -lmsvcrt
  8. -lpthread
  9. -ladvapi32
  10. -lshell32
  11. -luser32
  12. -lkernel32
« Last Edit: March 24, 2021, 04:38:11 am by skalogryz »

 

TinyPortal © 2005-2018