wtf8_decode
wtf8_decode

Reputation: 462

Forward type not resolved - Lazarus FreePascal

I am trying to use an external library from Pascal that I have successfully used from C before. In order to use this library I have been provided a .h file, a .dll file and a .lib file.

I converted the .h file using the h2pas utility but I am getting the following errors (which I suspect are linker-related):

Error: (5009) Forward type not resolved "XPRSbranchobject"

This appears to be the offending line:

type
    ...
    XPRSbranchobject = ^xo_user_branch_entity_s ; 

How do I let Lazarus know that xo_user_branch_entity_s is part of the external library?

Upvotes: 0

Views: 562

Answers (1)

You could simply write:

type
  xo_user_branch_entity_s = record
    a: integer;     // <-- probably redundant
  end;
  XPRSbranchobject = ^xo_user_branch_entity_s;

You must be sure you never (de)allocate such object (the record, either directly or via pointer); if the sources tries to access internal members, the compiler will complain.

This implies that allocation/deallocation is done by the DLL.

It should (could?) work...

Upvotes: 1

Related Questions