Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7531357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:08:57+00:00 2026-05-30T05:08:57+00:00

I am complete new to pascal. I want to call my function in .dll

  • 0

I am complete new to pascal.
I want to call my function in .dll file in free pascal and I get following error when I run the project:

The procedure entry point GetProcAddress could not be located in the dynamic link library HNLib.dll.

here is the code:

Program Test;
function GetProcAddress : Integer; cdecl; external 'HNLib.dll';
function GetProcAddress : Single; cdecl; external 'HNLib.dll';
procedure GetProcAddress( X : Single); cdecl; external 'HNLib.dll';
procedure GetProcAddress; cdecl; external 'HNLib.dll';
begin
  GetProcAddress( 5.5 );
  readln;
end.

.pas file and dll are in one directory.

Please Help ME!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:08:58+00:00Added an answer on May 30, 2026 at 5:08 am

    GetProcAddress is not what you seem to think it is; it’s purpose is to locate named procedures or functions in a DLL and return the address of that function so it can be called from your code. You have to first use LoadLibrary to load the dynamic link library (DLL) into memory, and then pass a handle to that DLL as the first parameter of GetProcAddress and the name of the function whose address you want as the second parameter. If the function can be found in the DLL, it’s address is returned, and you can use that address to call the function.

    (In addition, GetProcAddress is pretty Windows-specific, and the majority of functions in the WinAPI are stdcall and not cdecl. Unless you have documentation saying that the functions are using the cdecl calling convention, you should probably use stdcall.)

    You would also need at least the Windows unit in your uses clause, since that’s where GetProcAddress and LoadLibrary are declared.

    See the WinAPI documentation on LoadLibrary and GetProcAddress for more information.

    For a beginning programmer, you’ll probably find it easier to use static linking of the functions instead of dynamic (which you get with GetProcAddress). An example of static linking would be (untested !!!- just a quick code example, since I don’t have ‘HNLib.DLL’ to link against):

    // Your Dll import unit
    unit MyDllProcs;
    
    interface
    
      function GetIntCalcResult(const IntVal: Integer); 
    
    implementation
    
      function GetIntCalcResult(const IntVal: Integer); stdcall; external 'HNLib.dll';
    
    end.
    
    // Your own app's code
    program Test;
    
    interface
    
      uses MyDllProcs;
    
    implementation
    
    function DoSomethingWithDll(const ValueToCalc: Integer): Integer;        
    begin
      Result := GetIntCalcResult(ValueToCalc);
    end;
    
    begin
      WriteLn('DoSomethingWithDll returned ', DoSomethingWithDll(10));
      ReadLn;
    end.
    

    Note that when statically linking DLL functions like this, your DLL must be available when your app starts, and the function must be contained in that DLL; if not, your application won’t load.

    Also, note that you can’t typically have multiple functions with the same name in the DLL, as there’s no information available to use to figure which one to load when the load is being done. Each should have a separate, distinct name or the loading will probably fail.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am complete new to Hibernate and I have a question in the following
I am new to jdbc.I dont know anything about jdbc.I want complete and detailed
I am starting a NEW project into this complete new segment of microcontroller, so
From the wikipedia entry on NP-Complete: The easiest way to prove that some new
Guys i am very new to jQuery. I have started using the auto complete
I am trying to do this: List<Parent> test = new List<Child>(); The complete code
I'm getting this error: uninitialized constant OpenidsController I can't figure out why. I'm following
I'm relatively new to Clojure and a complete HTML/Compojure virgin. I'm trying to use
I'm really new at network-programming, so I hope this isn't a complete Newbie-question. I
Where do I find a complete list of new T-SQL features in sql server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.