PieThon
PieThon

Reputation: 67

Where do i put the declarations of my DLL? + how to use it in onther language [C]

1) Lets say I create this DLL called MyDLL in c. I have 2 files, 1 is MyDLL.c and the 2nd is MyDLL.h, than I compile the code and get MyDLL.a and MyDLL.dll. I know how i can use this dll in a new C project, I just include my MyDLL.h and give the linker the path for my MyDLL.a now lets say that I dont have the MyDLL.h, than i need to call LoadLibrary() but all the function's prototypes and all the typdefs MACROs and structs in the MyDLL.h, so how the program will know all this declarations? or lets say I want to use the DLL in C# project or JAVA project? i cant include MyDLL.h..

2) If I have a function in the dll that get pointers as parametrs(void *, int * etc..), how can I send pointers as parameters if I dont have pointer in C# and JAVA or any other language? Or if the function get struct for parameter? Or even a pointer to function?

Upvotes: 0

Views: 65

Answers (1)

Nemanja Trifunovic
Nemanja Trifunovic

Reputation: 24561

Most languages you mention define their own foreign function interface (FFI) which is a mechanism for calling code written in other languages. FFI for Java is called JNI, and for C# - P/Invoke.

Upvotes: 1

Related Questions