Sign in to follow this  

linking Dll generated at runtime

This topic is 3460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, How do we link a DLL which itself is being generated at runtime. i want to export one function from Dll. i am working in Visual Studio, so the function(to be exported) does have a definition at compile time , so i can't compile the code itself and hence can't proceed to the Dll linking step. Plz help me out. TIA, Apa

Share this post


Link to post
Share on other sites
It seems to me that you would need to use LoadLibrary, GetProcAddress (et al) and that you would need a means of inputing the dll name and the function name to use with those two functions.

Share this post


Link to post
Share on other sites
hi,
thanx for your reply.But when i use load library ,getprocaddress i will get a function pointer to my function and then call the function.But you can see the point the i have to compile the code also which can't be done as the dll which we mentioned in load library is still not created(i plan to create it a t runtime..)

any suggestion is most welcomed.
Regards,
apa

Share this post


Link to post
Share on other sites
Quote:
Original post by chetanapa
When I use LoadLibrary/GetProcAddress, I will get a function pointer to my function and then call the function.
But you can see the point - I have to compile the code also which can't be done, as the DLL which we mentioned in load library is still not created yet (I plan to create it at runtime..)

LoadLibrary and GetProcAddress take variable strings as input and are evaluated at runtime (not at compile time).
This means that you can use them to load a DLL which was created at runtime, and to get a function pointer to a function that didn't exist yet at compile time.
At compile-time, you only need to know the function signature (e.g. return type, input types) - the DLL doesn't have to exist, and you don't need to know the name of the function or the name of the DLL.

Share this post


Link to post
Share on other sites

This topic is 3460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this