Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Please help me change static library into dynamic dll

kukuta
Beginner
701 Views

Hi all,

I have a static library, but i cannot use it so i want to change it into dynamic library. Any ideas is great.

Someone know please help me, thanks

best regards

0 Kudos
10 Replies
JenniferJ
Moderator
701 Views

On Windows, you need to create a DLL project to export all the lib functions you'd like to export.

But to export lib functions in the DLL project, there're two methods to do that.

1. using .def file

2. using "__declspec(dllexport)" by adding all the function prototypes with this in one file in DLL project.

Well, one important note: Intel C++ Compiler only support the 2nd method.

0 Kudos
kukuta
Beginner
701 Views

Hi JeniferL,

Thank you for your instructions.

My project have a lot of *.h files. so have I add all of them on the project? Since I am using ipl98 library version 2.20 and I must use it in the Borland C++. However, I compile ipl98 library by Borland C++, the dll and lib file create: cannot use them. just only the static lib is created by VC++.net, it can use.

If the first method cannot be successful, the second method, I think it is defficult to do. Therefore, I hope that you will show clearly. Thank you very much.

I hope I will get the feedback as soon as posible.

Best regards

0 Kudos
kukuta
Beginner
701 Views

Hi JenniferL,

Now, I have a static library and dynamic library(they arecreated by VC++.net). The static library can do in the VC++.net(running with example, it is ok, butthe dynamic cannot run with the example) . However, I want to use it in the Borland C++. Do you have any advices or ideas?

Can you do transition static libraryinto dynamic library? Or Can You use static library in Borland C++? Or you have another way to solve it. Please help me and give me emergency exit

Since I have no experience about dll and lib so I hope that you will show me step by step!

Thanks alot

Best Regards

0 Kudos
support1
Beginner
701 Views
madjljiang:
But to export lib functions in the DLL project, there're two methods to do that.

1. using .def file

2. using "__declspec(dllexport)" by adding all the function prototypes with this in one file in DLL project.

Well, one important note: Intel C++ Compiler only support the 2nd method.

As far as I can see, definition files don't work only if Whole Program Optimization is set to Use Link Time Code Generation. If it's set to No Whole Program Optimization, .def file works just fine.

Note that adding __declspec(dllexport) may make a function incompatible with its intended declaration. For example, if you add this specifier to an ISAPI function, such as GetFilterVersion, you will get a compiler error that the symbol is incorrectly redeclared. Using a .def file in this case makes everything work together nicely.
0 Kudos
JenniferJ
Moderator
701 Views

About the .def and /GL (whole program optimization), are you talking about VC2005 or Intel C++ Compiler?

For ISAPI function "GetFilterVersion", the declaration is in a header file. So if you add another different declaration, it won't work. But those type of functions don't need to be exported. you can use it directly from another project.

About :

Can you do transition static libraryinto dynamic library? Or Can You use static library in Borland C++? Or you have another way to solve it. Please help me and give me emergency exit

I don't know how Borland C++ works. But I'd guess it should be compatible with VC. You should be able to add the .lib file as an input file (or additional library file) to Borland C++'s linker.

0 Kudos
support1
Beginner
701 Views
madjljiang:
About the .def and /GL (whole program optimization), are you talking about VC2005 or Intel C++ Compiler?
I referred to ICL integrated into VS2005, so both. If you meant VC (the compiler, that is), then no, it was not used.

madjljiang:
For ISAPI function "GetFilterVersion", the declaration is in a header file. So if you add another different declaration, it won't work. But those type of functions don't need to be exported. you can use it directly from another project.
That's not how it works. IIS loads an ISAPI filter (not the extension, a filter) on startup and needs several functions, including GetFilterVersion, exported. The filter won't load otherwise.

I just wanted to point out that .def files can still be used in some ICL configurations. Some projects rely on these files and being able to keep these files and not having to change the source does help.
0 Kudos
kukuta
Beginner
701 Views

Hi

Thank you for all instructions.

I mean all of you misunderstand my problems. I will do more detail for you understanding and giving me the best advices:

I am using ipl98 library version 2.20 and I was compile it successful. However, I can only use the static library is created by VC++.net (It can run ok with the example in ipl98 library project.) The dynamic library cannot use it to run the example.

About Borland C++, I also compile successfully but the dynamic library cannot do with the example. After that I compile it to create the static library, this is not successful, the error: library too large, please restart with library page size 32.

My purpose is using ipl98 library version 2.20 in the Borland C++. Howevere, I spent a lot of time but until now I also cannot use it in the Borland C++. If you have any advices, any ideas, or any instructions please show me!

Can we use the static library created by VC++.net to transition dynamic library? Or Can we use the static library in Borland C++? Or you have another ways to solve it.

I hope I will get your feedback as soon as posible.

Best regards!

0 Kudos
support1
Beginner
701 Views
kukuta:
The dynamic library cannot use it to run the example
Can you provide any details? If you get any error messages (console, system dialog, system event log, etc), quote those messages.
0 Kudos
kukuta
Beginner
701 Views

Hi

Thank you very much, I look for the causesand havethe method tosolve them. Now everything is OK.Once again I want totalk to you: thanks for your help. However, I still havea problem that I want to ask you, I hope you will help me.

I have a static library and I wanttransition itinto dynamic library. If you know please show the way to do it. Since I see if we can be transition dynamin library into static library, the otherwise we can also do. And I can do transition dynamiclibrary into static library (implib) and otherwise I cannot do. However, I hope you know (You can be transition static lib into dynamic lib)and show me the way to do this.

Best Regards!

0 Kudos
levicki
Valued Contributor I
701 Views

Read this and you will hopefully understand how to do what you need to do.

0 Kudos
Reply