Recent

Author Topic: DLL To C  (Read 3204 times)

Sora-Kun

  • Full Member
  • ***
  • Posts: 162
  • I can smell your presence ...
    • Sora-Kun
DLL To C
« on: August 05, 2011, 02:13:05 pm »
Hi all,
  I want if it's possible to create DLLs in Lazarus, and then use them in C ?
Because I created a simple one, but C can not find any function, actually, I opened the dll with a dll file viewer, and there is no function/variable located.

this the example that i tried:
Code: [Select]
library project1;

{$mode objfpc}{$H+}

uses
  Classes
  { you can add units after this };

function strtoint(s: string): integer;
var x, e: integer;
begin
   val(s, x, e);
   strtoint := x;
end;


begin

end.

Thanks a lot.
Cheers,
KingXerXes
if nothing suites you, make it your self!
The Revolution, Genesis. The next generation IDE.
If you want to help, PM me.

Made in Lazarus.
Soon, in The WWW.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: DLL To C
« Reply #1 on: August 05, 2011, 03:07:55 pm »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: DLL To C
« Reply #2 on: August 05, 2011, 03:10:24 pm »
Have a look at the FPC documentation, e.g. unit dynlib, I believe there's a discussion on using FPC DLLS with C (use of stdcall etc)

Here's info on writing a DLL for Apache that might be applicable, too: http://wiki.lazarus.freepascal.org/FPC_and_Apache_Modules
Same for C#/.Net/VB.Net/Oxygene:
http://wiki.lazarus.freepascal.org/Using_Pascal_Libraries_with_.NET_and_Mono

Strange that there I can't find anything on the wiki for C/C++ - probably searching on the wrong terms...
Oh, here's some more info:
http://wiki.lazarus.freepascal.org/Lazarus/FPC_Libraries
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Sora-Kun

  • Full Member
  • ***
  • Posts: 162
  • I can smell your presence ...
    • Sora-Kun
Re: DLL To C
« Reply #3 on: August 05, 2011, 03:51:18 pm »
Hi all,

   Thanks a lot people :) actually it's not about forget it's my 1st time with DLLs.
Thanks a lot.
Big hug, KingXerXes.
if nothing suites you, make it your self!
The Revolution, Genesis. The next generation IDE.
If you want to help, PM me.

Made in Lazarus.
Soon, in The WWW.

 

TinyPortal © 2005-2018