thanks, I'll try that out
Printable View
thanks, I'll try that out
ok, here's some more info: listed above the error messages is this:
C:\dmc\dm\bin\..\lib\SNN.lib(thsup)
Error 42: Symbol Undefined _GetCurrentThreadId@0
C:\dmc\dm\bin\..\lib\SNN.lib(semlock)
Error 42: Symbol Undefined _CreateSemaphoreA@16
C:\dmc\dm\bin\..\lib\SNN.lib(semlock)
Error 42: Symbol Undefined _ReleaseSemaphore@12
and the list goes on. still the same advice?
Yes. Those 3 functions are all defined in kernel32.dll.
usually, I don't have problems with crap like this, but i cant remember where kernel32.dll is. :o
I found it!
I'm not sure if i made this clear enough. I'm not trying to write a program using code from a DLL, I'm trying to write my own DLL for a BASIC App. that I'm working on. I want to write it, because im hoping that a C function will be faster than a BASIC function. any advice?
On how to write your own DLL?
yes. absolutely. thats what ive been trying to do this whole time... any clue what I'm supposed to do?
This depends on your compiler. I've never used the digitalmars compiler before, so I can't help you. I suggest reading your compiler's documentation and help files.
Typically, you need to tell your compiler which functions are being exported. This is done with a .DEF file, or a keyword in the exported function's signature (like __declspec(dllexport) on MSVC compilers). Lastly, there is some directive that you give to the linker which tells it you are creating a DLL file instead of a normal executable.
yeah, i knew that I had to use the commandline switch -WD, but as for the definitions file, do I link to the def file or what?
yes, you do.
do i link the a library to the .def file, or do I link the program to the .def file? Can you maybe give me an example program and def file, so that i can see what i need to do?
That question doesn't really make sense. You pass the DEF file to the linker during the linking stage. On MSVC this is done by "/def myfile.def".
Here is an example of a .DEF file:
And your code:Code:; myfile.def : exported library symbols
LIBRARY "mylib"
DESCRIPTION 'mylib Windows Dynamic Link Library'
EXPORTS
foo
bar
Code:int __stdcall foo(void)
{
return 1;
}
void __stdcall bar(int a)
{
a++;
}
well, my compiler preprocesses, links, and compiles all on its own. do i need to link the def file to my program, or to a library file, such as the above kernel32.lib?
do i need to declare a main() function in the program? the DLL compiles right when i do, but i dont understand how i would call the function in the DLL file... this is alot more complicated than it needs to be.... :(