Skip to main content
Participant
Dec 7, 2021 2:34 AM UTC
Answered

Why can't I find many structs definition in header files of PDFL SDK?

When I follow the header files in PDFL SDK, I found there are many structs which don't have a complete type.

 

For example, there is a definition:

 

typedef struct _t_PDDoc *PDDoc;

 

 

However, there is no definition of `struct _t_PDDoc`. And I also don't find any code which make it import.

 

So, how can the code complie successfully? What is the type indeed? When I try to use the `struct _t_PDDoc` directly in my code, there is always a mistake made by VS.

This topic is closed to new replies. Start a new post to keep the conversation going.
Test Screen NameCorrect answer
Legend
Dec 7, 2021 8:17 AM UTC

The code can compile successfully because that is how C and C++ are defined. Pointers to an undefined structure are all pointers so they can be compiled. The compiler does type checking so they are distinct. 

These are called opaque types. There are many in the PDF library (in this case, identical to the Acrobat SDK).  I have no idea why you would want to use the PDDoc structure in your code, but whatever the reason, you can't. 

3 replies

Test Screen NameCorrect answer
Legend
Dec 7, 2021 8:17 AM UTC

The code can compile successfully because that is how C and C++ are defined. Pointers to an undefined structure are all pointers so they can be compiled. The compiler does type checking so they are distinct. 

These are called opaque types. There are many in the PDF library (in this case, identical to the Acrobat SDK).  I have no idea why you would want to use the PDDoc structure in your code, but whatever the reason, you can't. 

Translate
Participant
Dec 7, 2021 8:28 AM UTC

Thank you, I got it.

Translate
Bernd Alheit
Community Expert
Community Expert
Dec 7, 2021 7:54 AM UTC

Contact the support of this library.

Translate